SELECT * FROM 表名 WHERE 重复字段 IN (
SELECT 重复字段 FROM 表明 GROUP BY 重复字段 HAVING COUNT(1)>1
)
AND id NOT IN (
SELECT MIN(id) FROM 表名 GROUP BY 重复字段 HAVING COUNT(1)>1
)
;
SELECT * FROM 表名 WHERE 重复字段 IN (
SELECT 重复字段 FROM 表明 GROUP BY 重复字段 HAVING COUNT(1)>1
)
AND id NOT IN (
SELECT MIN(id) FROM 表名 GROUP BY 重复字段 HAVING COUNT(1)>1
)
;
本文标题:Mysql 查询出可以删除的重复数据(最新日志)
本文链接:https://www.haomeiwen.com/subject/mvkpidtx.html
网友评论