WHAT I HAVE
I have two tables with the same structure. We can say that one is the main table, while the other is a side table, meaning that each row tracks an edit to a corresponding row from the main one. In order to match the edit to the original row I obviously use some keys.
WHAT I WANT TO DO
I need a query that returns a result set where the edit rows replace the originals.
For example I have this row in the side table:
which matches, by the person ID and the date which are KEYs, the highlighted row in the main table (below)
The query should return a set of four tuples where the row 96368
is replaced with the values from the edit row.
What kind of approach do you suggest? At the beginning I've taken into consideration an UNION, since the two tables share the same structure, but I don't know how to make the edits to mask the original rows.