一句sql 删除 数据库重复记录

来源:互联网 发布:php开源网站管理系统 编辑:程序博客网 时间:2024/05/01 09:06


delete a from 表名 a, (select *,min(主键) as c from 表名 group by 重复字段 having count(1) > 1) as b

where a.重复字段= b.重复字段 and a.主键 > b.c