Re: filter duplicates by priority

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: filter duplicates by priority
Дата
Msg-id 20090714155630.GB9600@svana.org
обсуждение исходный текст
Ответ на filter duplicates by priority  ("Clark Slater" <pg@slatech.com>)
Список pgsql-general
On Tue, Jul 14, 2009 at 10:04:12AM -0400, Clark Slater wrote:
> Hello-
>
> I am trying to use DISTINCT ON to filter out *potential* duplicate values
> from a set of sub queries.  There are certain cases where there can be
> repetitive part numbers that are priced differently.  I'm trying to start
> with the full list, ordered by priority, and then remove any repeats that
> have a lesser priority.

I think what you need to do is order by part_number first, do the
DISTINCT ON () and then do an ORDER BY priority around that.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: filter duplicates by priority
Следующее
От: Sam Mason
Дата:
Сообщение: Re: filter duplicates by priority