delete from titles_test
where id not in (select * from
(select min(id) from titles_test group by emp_no) as a )
注意事项: 1.可以用子查询来筛选最小id 2.mysql不支持在查表的同时删表,因此需要额外给表命名。
delete from titles_test
where id not in (select * from
(select min(id) from titles_test group by emp_no) as a )
注意事项: 1.可以用子查询来筛选最小id 2.mysql不支持在查表的同时删表,因此需要额外给表命名。