MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » December 2001

RE: SQL Question (Comparing 2 files)



fixed

I got it figured out. I was missing something in my select statement,
although I completely forgot what I did now (long day yesterday ;-). Thanks.
I have another SQL question I just posted on the RPG list that I could use
some help on. ;-) ;-)

-----Original Message-----
From: Danny Oentung [mailto:DANNY@MULTIPOLAR.CO.ID]
Sent: Monday, December 17, 2001 8:44 PM
To: 'midrange-l@midrange.com'
Cc: 'Wills, Mike N. (TC)'
Subject: RE: SQL Question (Comparing 2 files)


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: 'midrange-l@midrange.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-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
_______________________________________________
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-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact