Re: [GENERAL] filter duplicates by priority

2009-07-15 Thread Clark Slater
This solved my problem. Now why didn't I think of that!? Thank you very much everybody. This list is an incredible resource. -Clark > AFAICS, changing it to ORDER BY part_number,priority would solve the > stated problem. If you really need the final result in priority rather > than part numb

Re: [GENERAL] filter duplicates by priority

2009-07-14 Thread Sam Mason
On Tue, Jul 14, 2009 at 10:04:12AM -0400, Clark Slater wrote: > SELECT DISTINCT ON (part_number) * FROM ( > SELECT part_number, priority FROM ... > UNION ALL > SELECT part_number, priority FROM ... > UNION ALL > SELECT part_number, priority FROM ... > ) AS filter_duplicates ORDER BY priority,part_n

Re: [GENERAL] filter duplicates by priority

2009-07-14 Thread Martijn van Oosterhout
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

Re: [GENERAL] filter duplicates by priority

2009-07-14 Thread Tom Lane
"Clark Slater" writes: > 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 the

Re: [GENERAL] filter duplicates by priority

2009-07-14 Thread Hartman, Matthew
> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Clark Slater > Sent: Tuesday, July 14, 2009 10:04 AM > Subject: [GENERAL] filter duplicates by priority Maybe I'm missing something, but why not something like (incoming pse

[GENERAL] filter duplicates by priority

2009-07-14 Thread Clark Slater
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 tha