SQL SERVER – Delete Duplicate Records – Rows « Journey to SQL Authority with Pinal Dave : "Following code is useful to delete duplicate records. The table must have identity column, which will be used to identify the duplicate records. Table in example is has ID as Identity Column and Columns which have duplicate data are DuplicateColumn1, DuplicateColumn2 and DuplicateColumn3. DELETE FROM MyTable WHERE ID NOT IN ( SELECT MAX(ID) FROM MyTable GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn2)
I love Programming, and Eager to learn New things Curious about Microsoft Products, Interested in Knowledge sharing. If you can dream IT, You can become it, If you can think IT, You can do IT, If you can believe it, you can achieve IT.