删除两个相同的数据

Delete from t_book where t_id in (select id from (select max(t1.t_id) id from t_book t1 group by t1.t_name having count(1)>1) ab);

利用group by 查询出相同的数据,然后分组的数据大于1的得到一个id。删除这个id就行了。

原文地址:https://www.cnblogs.com/bulrush/p/10694708.html