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)

posted @ 2016-07-12 14:14  haohaizi  阅读(1169)  评论(0编辑  收藏  举报