From: Michael Landin Hostbaek <mich@the-lab.org>
To: PostgresSQL list <pgsql-sql@postgresql.org>
Subject: Where clause
Date: Tue, 26 Jun 2007 10:24:05 +0200
Message-ID: <20070626082405.GA67974@mich2.itxmarket.com> (raw)
Hello,
I have a table called tracking, with a contactid varchar, click bool,
view bool and cid varchar.
I would like to put the following into one single query if possible:
// Number of clicks
select cid,count(distinct contactid) from tracking where click =
true group by cid;
// Number of views
select cid,count(distinct contactid) from tracking where view =
true group by cid;
I guess I have to put where (click = true or view = true) - and
differentiate them in the SELECT target.. ?
Many thanks for any input,
Mike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mich@the-lab.org
Subject: Re: Where clause
In-Reply-To: <20070626082405.GA67974@mich2.itxmarket.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox