Search Postgresql Archives

Re: filter duplicates by priority

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux