Sqlserver删除重复记录,保留最新(ID最大)的一条

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_21425067/article/details/84753631
Delete A from GIS_Mall_Info A 
inner join ( select MAX(id) as ID,Ref_ID from GIS_Mall_Info group by Ref_ID having count(1)>1 ) 
B on B.Ref_ID=A.Ref_ID and B.ID<>A.ID

 

展开阅读全文

没有更多推荐了,返回首页