I have two structurally identical tables, table2 is an intermediate platform for new data that will be used in the update mass table.
I need to find out which rows will be updated in table1. I want to ignore the rows that will be inserted, and those that will be deleted. I'm just interested in updated rows where the primary key remains the same, but one or more other fields in the row contain different data.
So far, the closest I have come to the following statement.
SELECT table2.* FROM table2 INNER JOIN table1 ON table1.primarykey = table2.primarykey WHERE table1.field1 != table2.field1 OR table1.field2 != table2.field2 OR table1.field3 != table2.field3
This returns 0 rows.
EDIT: The request really works. There was a problem with the data itself. I am going to go facepalm for a while.
Thank you all for your input.
Mancmaniak
source share