sql 当重复的数据有多条时,保留一条,删除其他重复

delete from proj_info where   newcode in (select newcode    from proj_info group by newcode      having count(newcode) > 1) and   NID not in (select min(nid) from proj_info group by newcode     having count(newcode)>1)

原文地址:https://www.cnblogs.com/xinxinzhihuo/p/5663351.html