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

Home -> Community -> Usenet -> c.d.o.server -> Re: URGENT Join question

Re: URGENT Join question

From: Stephen Bell <stephen.bell_at_cgi.ca>
Date: Thu, 9 Aug 2001 08:04:11 -0400
Message-ID: <f1vc7.40868$jA2.3431062@news20.bellglobal.com>

Hi !

Okay...I've reproduced what you did :

SQL> select distinct b.col1,b.col2 from table2 b , table1 a where b.col1   2 <> a.col1 and a.col2 = b.col2 ;

COL1                      COL2
-------------------- ---------
HELLO WORLD NOW              1

Have you ever heard the old joke "What are the two coins that add up to 35 cents if one is not a quarter?" The answer is "a dime and a quarter"..."but you said one is NOT a quarter! "....yeah, the OTHER one's a quarter....

the and clause is superfluous because given your data col2 is equal...it compares col2 in table2 to EACH of the columns in table 1..you get one record returned for the case where "Hello world now" does not equal "Hello world"..

Hope this helps,

Steve
"Manoj Nair" <debo_nair_at_yahoo.com> wrote in message news:92a0e580.0108081623.e512163_at_posting.google.com...
> I have 2 tables
>
> Table 1
> col 1 varchar2
> col 2 numeric
>
> Table 2
> col 1 varchar2
> col 2 numric
>
> Table 1 data
> HELLO WORLD 1
> HELLO WORLD NOW 1
>
> Table 2 data
> HELLO WORLD 1
>
> when i run
>
> select distinct b.col1,b.col2 from table2 b , table1 a where b.col1
> <> a.col1 and a.col2 = b.col2 I want no records to be returned
> cos HELLO WORLD is already present in table 1..
>
> however it returns HELLO WORLD NOW 1
>
> Thanks
Received on Thu Aug 09 2001 - 07:04:11 CDT

Original text of this message

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