Please visit SQLVERSITY.COM for more details.
Any of the two records should be deleted out of three records in the above table.
WITH DeleteDup AS ( SELECT ROW_NUMBER() OVER (PARTITION BY EmployeeID ORDER BY EmployeeID) AS RowNum FROM dbo.DuplicatedEmployee ) -- Delete the duplicate records. DELETE FROM DeleteDup WHERE RowNum > 1 -- Now Check the data. SELECT * FROM dbo.DuplicatedEmployee