Thursday, November 15, 2012

Delete duplicate rows in table with no key in SQL Server

Delete duplicate rows in table with no key in SQL Server:

DELETE
FROM  TableName
WHERE TableName.%%physloc%%
      NOT IN (SELECT MIN(b.%%physloc%%)
              FROM TableName b
              GROUP BY b.ColumnName)

No comments:

Post a Comment