Re: [HACKERS] SELECT DISTINCT question
От | Hannu Krosing |
---|---|
Тема | Re: [HACKERS] SELECT DISTINCT question |
Дата | |
Msg-id | 378BA6B1.2B226DDB@trust.ee обсуждение исходный текст |
Ответ на | SELECT DISTINCT question (Oleg Bartunov <oleg@sai.msu.su>) |
Ответы |
Re: [HACKERS] SELECT DISTINCT question
|
Список | 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
В списке pgsql-sql по дате отправления: