From: | Hannu Krosing <hannu(at)trust(dot)ee> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | hackers(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] SELECT DISTINCT question |
Date: | 1999-07-13 20:50:57 |
Message-ID: | 378BA6B1.2B226DDB@trust.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
Oleg Bartunov wrote:
>
> I got a problem with query:
>
> select distinct (date), bytes from access_log;
>
> which works but not as I expect. I thought this query will select
> all rows with distinct values of 'date' column, but it get
> distinct pairs 'date, bytes' . From documnetation I see
>
> "DISTINCT will eliminate all duplicate rows from the selection.
> DISTINCT ON column will eliminate all duplicates in the specified column;
> this is equivalent to using GROUP BY column.
If it is equivalent to GROUP BY then it should allow only aggregates
in non-distinct columns, like:
select distinct on date date, sum(bytes) from access_log;
If it does not, then it should be files as a bug imho.
-----------------
Hannu
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-07-13 21:31:48 | Re: [HACKERS] SELECT DISTINCT question |
Previous Message | Tom Lane | 1999-07-13 19:26:22 | Re: [HACKERS] PostgreSQL v6.5 - Tagged |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-07-13 21:31:48 | Re: [HACKERS] SELECT DISTINCT question |
Previous Message | Bruce Momjian | 1999-07-13 17:00:02 | Re: [SQL] Postgres ERROR |