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 -> ORACLE 8i Newbie DISTINCT and EXISTS problem

ORACLE 8i Newbie DISTINCT and EXISTS problem

From: stimpy <hampsonpaul80_at_hotmail.com>
Date: 26 Sep 2002 03:12:15 -0700
Message-ID: <4ded334d.0209260212.187a2fc@posting.google.com>


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

Original text of this message

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