Daniel Matthee (1/31/2016)
I have not tested but just by looking at the code will it not delete both the records???
There is nothing to indicate that you just want to get rid of all dups and only have a unique records left, or am I missing something here?
For example, you have table Customers (contactname VARCHAR(100) NOT NULL, Age INT)
You fill table
Insert into Customers (contactname, Age) VALUES ('Andrey',35),('Alexey', '40'),('Andrey',50);
SELECT ROW_NUMBER() Over(PARTITION BY C.contactname ORDER BY C.contactname)
As RowNumber,C.* FROM Customers C
1 Alexey 40
1 Andrey 35
2 Andrey 50
RowNumber partitioned inside contactname and it unique inside every contactname. If you delete RowNumber > 1 you delete duplicates.