Re: select count of distinct rows

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: select count of distinct rows
Date: 2005-12-11 01:23:14
Message-ID: 5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 07:53 PM 12/10/05, Havasvölgyi Ottó wrote:
>I would like to select the count of distinct rows in a table.
> SELECT COUNT(DISTINCT *) FROM mytable;
>This does not work. How can I do it with Postgres?

select count(*) from (select distinct * from mytable) as x;

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Havasvölgyi Ottó 2005-12-11 01:25:20 Re: select count of distinct rows
Previous Message Havasvölgyi Ottó 2005-12-11 01:17:13 Re: select count of distinct rows