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!
Many thanks,
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
am Tue, dem 26.06.2007, um 10:24:05 +0200 mailte Michael Landin Hostbaek
folgendes:
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
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
Στις Τρίτη 26 Ιούνιος 2007 12:44, ο/η Michael Landin Hostbaek έγραψε:
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
Michael Landin Hostbaek wrote:
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.
Michael Landin Hostbaek skrev:
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
[SIGH]
I was getting the syntax wrong. Just using ON rathar than = fixed
the mistake.
Time to crash for the night (day?) it seems
Thanks for the replies; if I hadn't've figured it out myself they
would have pushed me in the right direction.
-JimC
--
James Cloos [EMAIL PROTECTED]
I've a query which I'd have liked to word akin to:
SELECT guid FROM child WHERE the_fkey =
( SELECT id FROM parent WHERE name ~ 'some_regex' )
ORDER BY the_fkey, my_pkey;
I got around it by doing the SELECT id first, and then doing a SELECT
guid for each row returned,
On 9/10/06, James Cloos [EMAIL PROTECTED] wrote:
I've a query which I'd have liked to word akin to:SELECT guid FROM child WHERE the_fkey = ( SELECT id FROM parent WHERE name ~ 'some_regex' ) ORDER BY the_fkey, my_pkey;I got around it by doing the SELECT id first, and then doing a SELECT
guid for
Oops, see correction below...On 9/10/06, Aaron Bono [EMAIL PROTECTED] wrote:
On 9/10/06, James Cloos [EMAIL PROTECTED] wrote:
I've a query which I'd have liked to word akin to:SELECT guid FROM child WHERE the_fkey = ( SELECT id FROM parent WHERE name ~ 'some_regex' ) ORDER BY the_fkey, my_pkey;I
I've a query which I'd have liked to word akin to:
SELECT guid FROM child WHERE the_fkey =
( SELECT id FROM parent WHERE name ~ 'some_regex' )
ORDER BY the_fkey, my_pkey;
I got around it by doing the SELECT id first, and then doing a SELECT
guid for each row returned,
12 matches
Mail list logo