Sample Header Ad - 728x90

Compare two tables for discrepencies

0 votes
2 answers
559 views
I am trying to compare two tables in two separate databases (same instance) for a new data extract The tables have around 4 millions rows and due to how they've been extracted are not in the same order in each table, as they are just staging tables (there is no PKs). I have tried using (select * from table 1 Except select * from table 2) UNION ALL (select * from table 2 Except select * from table 1) however this results in around 10 millions rows so is not working as expected. I would guess the results should be around a few thousand.
Asked by QueryQuirk (3 rep)
Oct 2, 2023, 01:57 PM
Last activity: Oct 2, 2023, 04:09 PM