Monday, March 18, 2013

How to delete duplicate records from table in sql server


DELETE
FROM TableName
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM TableName
GROUP BY ColumnName)

No comments: