SELECT DISTINCT question

Поиск
Список
Период
Сортировка
От Oleg Bartunov
Тема SELECT DISTINCT question
Дата
Msg-id Pine.GSO.3.96.SK.990711000908.2043R-100000@ra
обсуждение исходный текст
Ответы Re: [HACKERS] SELECT DISTINCT question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
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. 
ALL will return all candidate rows, including duplicates."      
discovery=> select distinct on date,bytes  from access_log;
ERROR:  parser: parse error at or near ","
Regards,
    Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] Oddities with NULL and GROUP BY
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] SELECT DISTINCT question