Re: [HACKERS] SELECT DISTINCT question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] SELECT DISTINCT question
Дата
Msg-id 5707.931641508@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT DISTINCT question  (Oleg Bartunov <oleg@sai.msu.su>)
Ответы Re: [SQL] Re: [HACKERS] SELECT DISTINCT question  (Oleg Bartunov <oleg@sai.msu.su>)
Список pgsql-sql
Oleg Bartunov <oleg@sai.msu.su> writes:
> discovery=> select distinct on date,bytes  from access_log;
> ERROR:  parser: parse error at or near ","

The syntax for SELECT DISTINCT ON is just as brain-damaged as the
functionality itself: there's no comma after the column name.
You want

select distinct on date  date,bytes  from access_log;

The reason the functionality is brain-damaged is that there's no way to
know which tuple out of the set of tuples with a given "date" value will
be the one returned.

SELECT DISTINCT ON is not in SQL92, and I think it shouldn't be in
Postgres either...
        regards, tom lane


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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: SELECT DISTINCT question
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] Bad date representation