Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> ORACLE 8i Newbie DISTINCT and EXISTS problem
Hi
I'm a newbie and I am trying to get the common records between two
large tables
using the following query:
Select distinct (a.begval) from table_1 a where exists (select distinct (b.begval) from table_2 b);
I know table_1.begval has 15 distinct values and table.begval has only 2 distinct values (a subset of table_1).
What I can't understand is why the query returns all 15 distinct value form table_1 rather than the 2 values shared by both tables.Is it because it involves DISTINCT or is it because of the EXIST?
I know there are other ways to get this information (INTERSECT, IN etc.), what I can't understand is why this doesn't work.
Thanks in advance
Paul Received on Thu Sep 26 2002 - 05:12:15 CDT
![]() |
![]() |