Greetings from Norway,
I need your expertice in figuring out the best way to solve the following scenario:
I have two tables: OLD-DATA and NEW-DATA.
OLD-DATA looks like this:
Business-ID Department-ID Employer-ID Start-date Work-hours Position End-date 999888777 444555666 11223345678 20120625 3750 112233 999888777 444555666 99887765432 20100101 3750 332211
NEW-DATA looks like this:
Business-ID Department-ID Employer-ID Start-date Work-hours Position End-date 999888777 444555666 11223345678 20120625 3750 112233 999888777 444555666 99887765432 19101212 0800 112233 999888777 333222111 55667789012 20143101 3750 123456
As you may notice, the structure is the same, but the content may not be. In my example above, the first row of OLD-DATA and NEW-DATA matches, the second row has the same Employer-ID but unmatching start-date, work-hours, and position, while the third row only exists in NEW DATA.
The sole purpose of this query is to reflect the data that does not match.
So here's what I'd like the query to do:
- The columns of the two tables should be placed next to each other
- The rows should be grouped by Employer-ID
- The matching fields should be left blank, while the unmatching fields should be shown.
At the end, the query should look like this:
Employer-ID OLDDATA-Business-ID OLDDATA-Department-ID OLDDATA-Start-date OLDDATA-Work-hours OLDDATA-Position OLDDATA-End-Date NEWDATA-Business-ID NEWDATA-Department-ID NEWDATA-Start-date NEWDATA-Work-hours NEWDATA-Position NEWDATA-End-Date 11223345678 99887765432 20100101 3750 332211 19101212 0800 112233 55667789012 999888777 333222111 20143101 3750 123456
I would be the happiest guy south of the North Pole if any of you could guide me through the best way of solving the puzzle above!