Re: ORDER BY and DISTINCT ON

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: ORDER BY and DISTINCT ON
Дата
Msg-id 20031215140334.GA20111@wolff.to
обсуждение исходный текст
Ответ на Re: ORDER BY and DISTINCT ON  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: ORDER BY and DISTINCT ON  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Dec 15, 2003 at 06:14:59 -0600, Bruno Wolff III <bruno@wolff.to> wrote:
> 
> Doing things as above is pretty much the same as normal distinct on
> for purposes of which rows get selected. Of the possible rows that
> might get returned for a specific set of values from the distinct on
> expressions you will get the row that is first as ordered by the
> expressions in the order by clause. If the order by clause isn't selective
> enough there may be several rows that could be selected, but that is true
> for how distinct on works now.

Specifically the interpretation I think makes sense is that
SELECT DISTINCT ON (a, b, c) * FROM tablename ORDER BY d, e, f
should be treated as equvialent to
SELECT * FROM (SELECT DISTINCT ON (a, b, c) FROM tablename ORDER BY a, b, c, d, e, f) AS t ORDER BY d, e, f


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: ORDER BY and DISTINCT ON
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ORDER BY and DISTINCT ON