Where clause

From: Michael Landin Hostbaek <mich(at)the-lab(dot)org>
To: PostgresSQL list <pgsql-sql(at)postgresql(dot)org>
Subject: Where clause
Date: 2007-06-26 08:24:05
Message-ID: 20070626082405.GA67974@mich2.itxmarket.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2007-06-26 09:01:40 Re: Where clause
Previous Message Bart Degryse 2007-06-26 07:26:19 Re: Transactions and Exceptions