Re: COUNT DISTINCT - Mailing list pgsql-general

From Andrew McMillan
Subject Re: COUNT DISTINCT
Date
Msg-id 39703412.5463D952@catalyst.net.nz
Whole thread Raw
In response to COUNT DISTINCT  ("Eric Jain" <jain@gmx.net>)
Responses RE: COUNT DISTINCT  ("Eric Jain" <jain@gmx.net>)
List pgsql-general
Eric Jain wrote:
>
> 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"
>
> Any ideas how do I get this done properly?

SELECT count( DISTINCT(url,id) ) FROM log;

Seems to work for me...

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)


Cheers,
                    Andrew.
--
_____________________________________________________________________
            Andrew McMillan, e-mail: Andrew@cat-it.co.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

pgsql-general by date:

Previous
From: "Eric Jain"
Date:
Subject: COUNT DISTINCT
Next
From: "Eric Jain"
Date:
Subject: RE: COUNT DISTINCT