SQL SERVER – Delete Duplicate Records
DELETE FROM Demo WHERE ID NOT IN
(SELECT MAX(ID) FROM Demo GROUP BY ColumnA, ColumnB)
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 ColumnA, CoumnB

Comments
Post a Comment