Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Disregard duplicates based on a field

Re: Disregard duplicates based on a field

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Sat, 29 Apr 2006 08:14:35 +0200
Message-ID: <4453044a$0$12184$626a54ce@news.free.fr>

"Ed Prochak" <edprochak_at_gmail.com> a écrit dans le message de news: 1146266993.391433.251660_at_i40g2000cwc.googlegroups.com...
|
| mBird wrote:
| > I have a table with three fields:
| > f1, f2, f3
| > 1 a 432
| > 2 b 323
| > 3 a 345 <-- so 3 has an a and b entry
| > 3 b 345 <-- so 3 has an a and b entry
| >
| > I need all the distinct f1's but when choosing which of the duplicates to
| > keep be able to specify the priority choice of f2 being a. So...
| > -if there is only one distinct f1 then I want that row regardless of f2
| > -if there are multiple rows with the same f1's then I want the one that f2 =
| > a
| > 1 a 432
| > 2 b 323
| > 3 a 345
| > (notice I kept 3 a 345 but discarded 3 b 345)
| >
| > Thank you!
|
| what's wrong with:
|
| select f1, MIN(f2), f3 from yourtable
| group by f1,f3;
|
| ???
|

I think, as the OP explaination says it but as his exemple does not show it, that if you have "3 a 345" and "3 b 346" only the first one have to be displayed.

Btw, he does not tell anything if he has "3 b 345" and "3 c xxx".

Regards
Michel Cadot Received on Sat Apr 29 2006 - 01:14:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US