Delete cross duplicate rows from a table in SQL Server

A friend of mine asked me a very interesting question today that how to delete cross duplicate rows from a table? He had basically two columns named ID1 and ID2 in a table, there he had to find the cross duplicate rows of each combinations and then delete it by keeping only one combination. Initially I thought it is very simple and can be achieved easily but when I tried I got to know the tricky part. Anyway I did it after doing a lot of permutations combinations for 20 Min.


Prasad Sahoo

Prasad Sahoo, is an enthusiast of Microsoft technologies in general and a passionate database professional, mainly focusing on SQL Server performance tuning and business intelligence. He has contributed a long time of his career working on SQL Server and other RDBMS. If he is not busy with SQL stuff then he must be watching some Hollywood movies.

%d bloggers like this: