From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Clark Slater <pg(at)slatech(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: filter duplicates by priority |
Date: | 2009-07-14 15:56:30 |
Message-ID: | 20090714155630.GB9600@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2009-07-14 16:24:13 | Re: filter duplicates by priority |
Previous Message | Tom Lane | 2009-07-14 15:48:56 | Re: filter duplicates by priority |