删除行语法
delete from table_name where condition
本题答案
1.需要注意的点是,用 group by 的时候,select 后必须有分组字段,不然会报错;
2.并且删除和查询无法同时进行,所以用 emp_no 分组聚合出 min(id) 后,外层还需要再套一层 select
delete from titles_test where id not in (select a.min_id from (select emp_no ,min(id) as min_id from titles_test group by emp_no) a)