RE: COUNT DISTINCT - Mailing list pgsql-general

From Eric Jain
Subject RE: COUNT DISTINCT
Date
Msg-id NCBBJFHBEGOIAHBCBNCLAEEMCJAA.jain@gmx.net
Whole thread Raw
In response to Re: COUNT DISTINCT  (Andrew McMillan <Andrew@catalyst.net.nz>)
List pgsql-general
> 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...


--
Eric Jain


pgsql-general by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: COUNT DISTINCT
Next
From: Andrew McMillan
Date:
Subject: Re: COUNT DISTINCT