Delete from employee_salary
where emp_id in(
select emp_id from
employee_salary
group by emp_id,project,salary
having count(*)>1
);
ERROR 1093 (HY000): You can't specify target table 'employee_salary' for update in FROM clause
如何解决这个问题以及为什么这个查询没有运行?
最佳答案
试试这个:
Delete from employee_salary
where emp_id in(
select * from (
select emp_id from
employee_salary
group by emp_id,project,salary
having count(*)>1 )
as alias
)
我正在更改结果集的名称,以便它可以正常工作。
关于mysql - 错误1093(HY000): You can't specify target table 'employee_salary' for update in FROM clause,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48071733/