Re: Counting distinct rows

From: Einar Karttunen <ekarttun(at)cs(dot)helsinki(dot)fi>
To: John Taylor <postgres(at)jtresponse(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Counting distinct rows
Date: 2002-01-16 11:03:07
Message-ID: 20020116110307.GB28890@shellak.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 16.01.02 10:38 +0000(+0000), John Taylor wrote:
>
> Hi,
>
> I'm having problems counting the number of distinct rows in a table.
>
> I've tried the following:
>
> select distinct on(id) count(id) from basketupdates order by id desc;
>

SELECT count(distinct id) FROM basketupdates;
see http://www.postgresql.org/idocs/index.php?sql-expressions.html
for more information.

- Einar Karttunen

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Taylor 2002-01-16 11:17:26 Re: Counting distinct rows
Previous Message Oliver Elphick 2002-01-16 10:44:26 Re: select !working