I need to generate a report when I come across any differences in data in two almost identical tables. (I'm using Informix database Version 11.70.)
For instance: my live table has columns:
Live
Name ID TRN
XXX 1 10
Archive:
Date Name ID TRN
01/01/2018 XXX 1 10
31/12/2017 XXX 1 11
29/12/2017 XXX 1 12
The Archive table has the same set of columns except that it also has a date column so I can see what values the live table had at a given date.
How would I write a query to find if there was change of values in live data when compared with the archived data.
I tried this query:
select name,id,TRN from live
union
select name,id,TRN from archive
Though it works, is there a better/faster way around as in report I need to have both live data and difference in historic values.
Expected results in report:
Live:
01/01/2018|XXX|1|10
Archive
31/12/2017|XXX|1|11
29/12/2017|XXX|1|12