news.gmane.org (nis) writes:
> SELECT * FROM
> (
> select cid,count(distinct contactid) from tracking where click =
> true group by cid
> ) c1
> FULL OUTER JOIN
> (
> select cid,count(distinct contactid) from tracking where view =
> true group by cid
> ) c2
> USING (cid);
That did the trick!
Man
A. Kretschmer (andreas.kretschmer) writes:
> *untested*
>
> select cid, sum(case when click = true then 1 else 0 end), sum(case when
> view = true then 1 else 0 end) from ...
>
Thanks, but I need the DISTINCT contactid - I don't want the same
contactid counted twice.
Mike
-
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 vie
List,
I'm using the OFFSET / LIMIT combo in order to split up my query, so it
only parses 20 rows at a time (for my php-scripted webpage).
I'm using two queries; the first basically doing a select count(*) from
[bla bla]; the second grabbing the actual data while setting LIMIT and
OFFSET.
In a