delete from 表名 where id in (
select * from (
select id from 表名 where 字段名
in (
# 查找字段值重复的信息
select 字段名 from 表名 group by 字段名 having count(1)>1
) and id not in (
# 查找最小id记录
select min(id) from 表名 group by 字段名 having count(1)>1
)
) as 表名_copy
);
删除Mysql中一张表某个字段重复的数据
最新推荐文章于 2024-07-17 21:58:43 发布