码迷,mamicode.com
首页 > 数据库 > 详细

sql删除重复数据

时间:2019-09-12 13:04:36      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:delete   where   image   span   rom   city   png   删除   inf   

DELETE FROM city_info
WHERE 1=1
AND admin_id IN ( SELECT * from ( SELECT admin_id FROM city_info GROUP BY admin_id HAVING COUNT(admin_id)>1 ) as A)
AND id NOT IN ( SELECT * from ( SELECT MIN(id) FROM city_info GROUP BY admin_id HAVING COUNT(admin_id)>1 ) as B)

 技术图片

 

sql删除重复数据

标签:delete   where   image   span   rom   city   png   删除   inf   

原文地址:https://www.cnblogs.com/liuxinxin4288/p/11511097.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!