按照一般的写法如下
delete from table where id in select max(id) from table group by field having count(*)>1
然后你会发现很神奇的一幕
报错了
不能在FROM子句中为update指定目标表’
[Err] 1093 - You can't specify target table 'xcx_senswords' for update in FROM clause
只能通过 把查询出来的 数据作为一个表 再查询一下 就可以了
delete from table where id in select * from (select max(id) from table group by field having count(*)>1) a