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   <klep...@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.

Attachment: signature.asc
Description: Digital signature

Reply via email to