Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2004, 08:29 PM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to zobi
Default Look and Tell the Diffs .

Hi every body,
Could u plz. take a look to these two quries, they seems to me that they r equal, but they return different result sets back WHY?.
Note: - i v got the correct result from the first one.
        - i need to return tuples in Rel1 who have (a1,a2,a3) values not in Rel2
I
SELECT a0, a1, a2, a3
  FROM Rel1 WHERE (a1, a2, a3) NOT IN
      (SELECT b1, b2, b3 FROM Rel2)

II
SELECT a0, a1, a2, a3
  FROM Rel1 WHERE NOT EXISTS
   (SELECT r1.a1, r1.a2, r1.a3
       FROM Rel1 r1, Rel2 r2
          WHERE r1.a1=r2.b1 AND r1.a2=r2.b2 AND r1.a3=r2.b3)



 
Old March 3rd, 2005, 10:11 AM
Registered User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to SureshHyd
Default

For ur requirement, the first query is correct. The second query does not return any results if it finds any rows in inner query. Run the inner query separately and test it out. Then u will understand the problem with second one.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.