Want to Learn Javascript.

MSSQL Server – Delete Duplicate Rows – Records

11. June 2011 01:59 by Scott in   //  Tags:   //   Comments (8)

This is how I delete duplicate rows from the database.

DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)