MySQL添加唯一索引前去除重复数据 Leave a reply delete from YOUR_TABLE where id not in (select id from (select max(id) as id from YOUR_TABLE group by UNIQUE_FIELD) as b); 您可能也喜欢如下文章: [转] MySQL 建库 建用户 相关命令 PHP+MYSQL 两行Query搞定删除重复数据 Hive UNION ALL报错Top level UNION is not supported currently MySQL中随机select记录 MySQL中,Group By后,取每组的Top N条记录