错误方法)
DELETE FROM titles_test WHERE id NOT IN( SELECT MIN(id) FROM titles_test GROUP BY emp_no);MySQL中不允许在子查询的同时删除表数据(不能一边查一边把查的表删了)
正确方法)
DELETE FROM titles_test WHERE id NOT IN( SELECT * FROM( SELECT MIN(id) FROM titles_test GROUP BY emp_no)a); -- 把得出的表重命名那就不是原表了(机智.jpg