Re: [HACKERS] SELECT DISTINCT question
Hannu Krosing <hannu@trust.ee>
From: Hannu Krosing <hannu@trust.ee>
To: Oleg Bartunov <oleg@sai.msu.su>
Cc: hackers@postgreSQL.org, pgsql-sql@postgreSQL.org
Date: 1999-07-13T20:50:57Z
Lists: pgsql-hackers
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