select code,detalis into #Temp_table from Dup_Rec group by code,detalis having count(*) > 1delete from prcl where (rccode in (select code from Dup_Rec group by code having count(*) > 1) and rate in (select details from Dup_Rec group by details having count(*) > 1) )insert into Dup_Rec select * from #Temp_table Drop table #Temp_table