|
From: Darren Strong <darren@xxxxxxxxx>
To: "midrange-l " <midrange-l@xxxxxxxxxxxx>
Date: 05/18/2017 08:48 AM
Subject: SQL Comparing two identical files for differences with log file
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
We have a requirement to create an audit log of key values within a file
that register differences. This will be used downstream to update otherEXCEPT
files in a data warehouse type of system. Secondly, the actual file
difference need to be synced. So, I've done the following with the
keyword as a driver. I believe this performs well when looking formissing
values based on a key, but please noticed where I do something liketo
"select * from a except select * from b". This is to get records that
exist in both files, but have some kind of record difference that needs
be updated. I assume that this is a really brute force method offiguring
out what records don't match, so I wondered if there was a better way.
Ideally I would think something like a "join" of the two files, and then
saying "where a.* <> b.*", but that kind of syntax isn't available.list
create table darren/sild as(
with t1 as(
select i1.ILINVN,i1.ILLINE,'D' as OPER
from (select ILINVN,ILLINE from ERPLXFINF/SIL
except select ILINVN,ILLINE from ERPLXF/SIL) i1
union
select i2.ILINVN,i2.ILLINE,'I' as OPER
from (select ILINVN,ILLINE from ERPLXF/SIL
except select ILINVN,ILLINE from ERPLXFINF/SIL) i2
)
select * from t1
union all
select T2.ILINVN,T2.ILLINE,'U' as OPER from
(select * from ERPLXFINF/SIL except select * from ERPLXF/SIL) T2
where (T2.ILINVN,T2.ILLINE) not in (select ILINVN,ILLINE from T1)
) with data
___________________________________
Darren Strong
Dekko
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxquestions.
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.
Please contact support@xxxxxxxxxxxx for any subscription related
link:
Help support midrange.com by shopping at amazon.com with our affiliate
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.