How to delete a row if first row's code column equals to the second rows number column and second rows' code column equals to the first row's number column.
sql must not use loop
use this as sample code
CREATE TABLE #temp(id int, code int, Number int)
Insert into #temp values(1,2,1)
Insert into #temp values(2,1,2)
Insert into #temp values(3,2,3)
Insert into #temp values(4,2,3)
Insert into #temp values(5,2,3)
select * from #temp