Maybe you could use exist keyword in sql like If you want to find all the record in file 1 that not exist in file 2 then the sql is: SELECT A.VENNUM, A.VENDIV FROM FILE1 A WHERE NOT(EXISTS(SELECT * FROM FILE2 B WHERE A.VENNUM=B.VENNUM)) Select b.vennum,b.divnum from file1 a, file2 b Where not (exist(b.vennum=a.vennum)) -----Original Message----- From: Wills, Mike N. (TC) [mailto:MNWills@taylorcorp.com] Sent: 18 Desember 2001 4:57 To: 'email@example.com' Subject: SQL Question (Comparing 2 files) I am comparing 2 files that should have similar records in each file. For example file 1 has vennum and vendiv and file 2 has vennum and divnum. Both files are directly related to each other and should have one unique matching record in each file. I am trying to figure out which records don't have a match in the other file. How is this done? Is this what I should use? SELECT * FROM FILE1 A EXCEPTION JOIN FILE2 B ON A.VENNUM = B.VENNUM AND A.DIVNUM = B.DIVNUM It doesn't seem to give me the correct result set. TIA, Mike _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-Lfirstname.lastname@example.org Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.