Re: order by, but eliminating dupes

Поиск
Список
Период
Сортировка
Искать
От
Bruno Wolff III
Тема
Re: order by, but eliminating dupes
Дата
Msg-id
20030904031932.GA28420@wolff.to
Ответ на
Список
Дерево обсуждения
order by, but eliminating dupes LH <_pgsql-novice_@geekhouse.no-ip.com>
Re: order by, but eliminating dupes Bruno Wolff III <bruno@wolff.to>
Re: order by, but eliminating dupes Jeffrey Melloy <jmelloy@visualdistortion.org>
On Wed, Sep 03, 2003 at 22:52:44 -0400,
  LH <_pgsql-novice_@geekhouse.no-ip.com> wrote:
> So lets say I got a table A(x,y,z, Q) ordered by column Q, with contents
> like so:
> 
> But that kills the order of the subquery. I've tried group by x,y,z but
> then I can't ORDER BY Q.

I think you can do something like this:

select x, y, z from
  (select distinct on (x, y, z) x, y, z, q order by x, y, z, q)
  order by q;
В списке pgsql-novice по дате отправления
От: glenn
Дата:
Сообщение: Editing functions
От: Tom Lane
Дата:
Сообщение: Re: Using NOT IN
FAQ