Compare two SQL Tables

I was updating one table with data from another. However, when I did this there was a discrepancy between the number of rows I had in the update table and the number of rows updated.

Here the SQL that allowed me to compare and return the rows that were in the source but not the destination.

 

select * from TableA where not exists
(select * from TableB where TableA.ProductID =TableB.ProductID)

 

Handy

Leave Comment

Your email address will not be published. Required fields are marked *