思路:由题目只保留最小的id对应的记录,可以先将最小的id筛选出来
select min(id) from titles_test group by emp_no;
再删除即可
delete from titles_test where id not in (select * from (select min(id) from titles_test group by emp_no) a);
思路:由题目只保留最小的id对应的记录,可以先将最小的id筛选出来
select min(id) from titles_test group by emp_no;
再删除即可
delete from titles_test where id not in (select * from (select min(id) from titles_test group by emp_no) a);