Find Duplicates From Separate Tables using SQL

This might seem obvious to veterans, but was a HUGE help to me when I figured it out.  The key to finding duplicates using SQL is to change the join key in two tables to the column(s) you want to find duplicates on.  For instance, if I want to find all records from two tables that have duplicate addresses, I would script the following:

FROM    Customer1 INNER JOIN
        Customer2 ON Customer1.Address = Customer2.Address

This will, of course, give you all the records that have the same addresses…basic join information, but good to know in reference to removing duplicates from separate tables using SQL!

Leave a Reply