Solved

Unmatched records in Oracle 10g

Posted on 2009-07-07
3
541 Views
Last Modified: 2012-05-07
Greeting,
I need tbl1 and tbl2 in oracle 10g. I have field1 and field2 in both table. I need a sql stmt which will give me all the records in tbl1 without matching records in tbl2 base on field1&field2.

thanks in advance
0
Comment
Question by:mrong
3 Comments
 

Accepted Solution

by:
mrong earned 0 total points
ID: 24797182
here it is
SELECT Table1.*
FROM Table1 LEFT JOIN table2 ON
(table1.[fielda] = table2.[fielda]
AND
table1.[fielda] = table2.[fielda]
and etc...
)
WHERE (((table2.[fielda]) Is Null));
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 24801303
try the below :

SELECT a.*
FROM Table1 a
where not exists ( select 1 from table2 b where b.fielda = a.fielda and b.fieldb=a.fieldb );
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24801719
mrong: your query is already fine, the code of nav_kum_v should work exactly the same.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question