|
Hi, You may also use EXCEPT which returns all rows that are in table1 but not in table2 without specifying any key, i.e. the complete row will be compared: The following statment returns all rows that are in table1 but not in table2 and all rows that are in table2 but not in table1: ( Select * From Table1 Except Select * From Table2) Union ( Select * From Table2 Except Select * From Table1) Mit freundlichen Grüßen / Best regards Birgitta Hauser "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown) "If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!" -----Ursprüngliche Nachricht----- Von: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Michael Ryan Gesendet: Wednesday, March 07, 2007 19:03 An: Midrange Systems Technical Discussion Betreff: Re: Using SQL for File Record Comparison And that's true...but that one quick statement in Interactive SQL seems so inviting. :) On 3/7/07, DeLong, Eric <EDeLong@xxxxxxxxxxxxxxx> wrote:
I don't think this plays to SQL's strengths. You'd be able to do this fairly easily with the RPG cycle, using primary/secondary files by matching keys. RPG lets you compare the record format data, so only one test is needed to determine whether the primary and secondary records are alike. The cycle is not really necessary, but it plays nicely with your requirements.... JMO, Eric -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Michael Ryan Sent: Wednesday, March 07, 2007 11:28 AM To: Midrange Systems Technical Discussion Subject: Using SQL for File Record Comparison Does this make sense? Is there a better way? I'm trying to find out if two files are the same. Here's my SQL statement: SELECT count(*) FROM firstlib/mhrdclp a, secondlib/mhrdclp b where a.mdvnda = b.mdvnda and a.mdmdl = b.mdmdl and (a.mddual <> b.mddual or a.MDCMFRT <> b.MDCMFRT or a.MDLP <> b.MDLP or a.MDSF <> b.MDSF) File MHRDCLP has the following fields: mdvnda mdmdl mddual mdcmfrt mdlp mdsf I want to see if I have any records that match mdvnda and mdmdl have any of the other four fields different. Thanks! -- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx 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@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx 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.
This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.