From: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
---|---|
To: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: select count of distinct rows |
Date: | 2005-12-11 01:25:20 |
Message-ID: | 007101c5fdf1$c03c7360$0200a8c0@OTTO |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Yes, almost. I need the list of all different rows.
It's syntax error at the *.
ROW(*)
^
Otto
----- Original Message -----
From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Havasvölgyi Ottó" <h(dot)otto(at)freemail(dot)hu>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Sunday, December 11, 2005 2:16 AM
Subject: Re: select count of distinct rows
On 12/10/05, Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> 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 ;)
From | Date | Subject | |
---|---|---|---|
Next Message | Foster, Stephen | 2005-12-11 01:28:03 | Re: select count of distinct rows |
Previous Message | Frank Bax | 2005-12-11 01:23:14 | Re: select count of distinct rows |