The following is one approach to removing duplicate records from a table assuming the first entry is the one to keep.
FROM dbo.contact c1
INNER JOIN( SELECT emailaddress, MIN(contactid) AS contactid
GROUP BY emailaddress
HAVING COUNT(*) > 1
) c2 ON c1.emailaddress = c2.emailaddress
WHERE c1.contactid > c2.contactid
About the Author: