Wednesday, February 11, 2009

Delete duplicate records SQL-SERVER

select count(*)cnt,ibitm into jde_rk.dbo.ttt_11 from jde_rk.dbo.tttt_4102 group by ibitm  having count(*)>1


DELETE jde_rk.dbo.tttt_4102 
FROM jde_rk.dbo.tttt_4102 a, jde_rk.dbo.ttt_11 b
WHERE a.ibitm=b.ibitm
AND t1.col2 = holdkey.col2

No comments: