I need to find differences between 2 identically structured sql tables
Each table is being uploaded from a 3rd paty tool into sqlserver database.
The table structure is:
Issue ID-status-Who
Issue ID will not repeated within a table, though its not defined explicitly as primary Key
There could be additions/deletions/Updations between any 2 tables.
What I need
Number of rows added & their details
Number of rows deleted & their details
Number of rows updates & their details
How do I do this
1) is it better to use sql
2) or use datatables
You could do this using two left joins and regular join for the updates. This will show you, with respect to TableA, which rows are added, deleted, and updated. Note these could be contatenated into a single result set.
Note for the latter, if you need to handle null values, I think you’ll need to adjust the where clause.
If the tables are large and this is an ongoing operation, you should consider adding indexes on the join columns.