From: | Andrew McMillan <Andrew(at)catalyst(dot)net(dot)nz> |
---|---|
To: | Eric Jain <jain(at)gmx(dot)net> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: COUNT DISTINCT |
Date: | 2000-07-15 10:57:17 |
Message-ID: | 3970438D.B5C574B1@catalyst.net.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Eric Jain wrote:
>
> > SELECT count( DISTINCT(url,id) ) FROM log;
> >
> > Seems to work for me...
>
> Thanks... however:
>
> SELECT count( DISTINCT(url,id) ) FROM log;
> ERROR: parser: parse error at or near ")"
>
> SELECT count( DISTINCT url,id ) FROM log;
> ERROR: Aggregate functions may only have one parameter
>
> SELECT count( DISTINCT ON (url,id) ) FROM log;
> ERROR: parser: parse error at or near "on"
>
> ...
>
> > Well, actually:
> > advert=# select count( distinct ( redirect_from ) ) from redirect;
> > count
> > -------
> > 1980
> > (1 row)
> >
> > rather than:
> >
> > advert=# select count( redirect_from ) from redirect;
> > count
> > -------
> > 4211
> > (1 row)
>
> SELECT count(DISTINCT url) FROM log; does work. The problem is to
> extend the DISTINCT over several fields...
Right - I should have looked closer shouldn't I :-)
What about...
advert=# select count( distinct ( (text(advert_no) || text(pool_id)) ) )
from redirect;
count
-------
38
(1 row)
Cheers,
Andrew.
--
_____________________________________________________________________
Andrew McMillan, e-mail: Andrew(at)cat-it(dot)co(dot)nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267
From | Date | Subject | |
---|---|---|---|
Next Message | Jesus Aneiros | 2000-07-15 11:19:07 | Re: Re: Postgresql and Postmaster response |
Previous Message | Eric Jain | 2000-07-15 10:45:18 | RE: COUNT DISTINCT |