Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL question
Hi Miguel
This might work. I kind of doubt it actually. It does work on your little
test set but the logic have a suspicion that it only works because the set
is so simple. Give it a whirl though. If it doesn't work maybe you will
get some ideas from this at least.
select a,b from test
where a not in
(select a from test t1 where not exists
(select 1 from test where t1.a <> a and t1.b = b)
)
GOOD LUCK!
-- Graham Farquharson Tecskor Software Inc graham_at_tecskor.com miguel wrote in message <01bd2030$3d6218c0$0a0a2c0a_at_jmiguel.cet.pt>...Received on Wed Jan 14 1998 - 00:00:00 CST
>Hi,
>
>Table TEST (A,B)
>
>A B
>1 10
>1 11
>1 12
>2 10
>2 11
>2 13
>3 10
>3 11
>3 12
>4 8
>4 11
>4 14
>How can i obtain the records that have the same value B group by A. For
>example i want a query to return:
>A B
>1 10
>1 11
>1 12
>3 10
>3 11
>3 12
>
>Thanks
>Miguel
>