gpt4 book ai didi

mysql - 错误1093(HY000): You can't specify target table 'employee_salary' for update in FROM clause

转载 作者:行者123 更新时间:2023-11-29 06:49:26 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com