update employees set salary=salary*10/100+salary
where EmployeeID (select EmployeeID from employees where salary<2000)
答案 0 :(得分:1)
尝试IN
update employees set salary=salary*10/100+salary
where EmployeeID IN (select EmployeeID from employees where salary<2000)
根据Lamak的建议
update employees set salary=salary*10/100+salary
where salary<2000
另一种选择。
update employees e1 set salary=salary*10/100+salary
where EXISTS (select NULL
from employees e2
where e2.salary<2000
and e1.EmployeeID = e2.EmployeeID
)
EXISTS
在您的情况下是过度杀伤,但可能非常有用。
You should read about it. here's a good start :-)
在您的情况下,您应该只使用WHERE子句中的条件salary<2000
。