mysql不允许子查询的同时删除原表数据
作者:互联网
错误:
delete from titles_test
where id not in(
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
)
https://www.nowcoder.com/practice/3d92551a6f6d4f1ebde272d20872cf05?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1
标签:group,no,mysql,查询,titles,原表,test,id,select 来源: https://www.cnblogs.com/hzyhouse/p/15353613.html