I have two identically set up tables that track water samples, the first table was in June and the second was taken in November. I need to produce a report on what values have changed over time.
I have a unique column called "SampleNumber" and the tables look as below, also see the result I want, how is this possible?
June Sample Table: Called 'OLDSample'
SampleNumber | BatchNumber | Mass | User01 |
---|---|---|---|
S00000001 | NH2318 | 15 | BLUE |
S00000002 | HY1318 | 5 | GREEN |
S00000003 | HH2098 | 10 | YELLOW |
November Sample Table: Called 'Sample'
SampleNumber | BatchNumber | Mass | User01 |
---|---|---|---|
S00000001 | NH2318 | 15 | BLUE |
S00000002 | HY1320 | 5 | GREEN |
S00000003 | HH3098 | 10 | PINK |
Report data needed in a new table called 'History'
SampleNumber | Notes |
---|---|
S00000002 | BatchNumber was HY1318 now HY1320 |
S00000003 | BatchNumber was HH2098 now HH3098 User01 was YELLOW now PINK |
So basically the query must ignore anything that is the same in both databases but highlight those that have differences, with a copy of the old and the new values for each column.
any help or pointing in the right direction would be fantastic. I've taught myself SQL and can handle basic queries but this is a bit beyond me.