On 12/10/05, Havasvölgyi Ottó <[EMAIL PROTECTED]> wrote:
> Hi,
>
> 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?
>
> Thanks,
> Otto
>

I guess what you need is to know how many times a single row is
duplicated so i think what you need is something like this:

SELECT fld1, COUNT(DISTINCT fld1)
   FROM (SELECT ROW(*) as fld1 FROM mytable) AS foo
 GROUP BY fld1;

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to