update employee
set Salary=Salary+1000
where Eid in(select Eid from orders where
QTY=(select max(QTY) from orders))
不能直接查max呀,要根据员工分组求和再max
比如这种工号一样的,你肯定要把工号一样的数据加起来,才算是他的订单总量
可以参考下这个
update employee
set Salary=Salary+1000
where Eid in (select Eid from orders group by Eid
having(count(*)=(select count(*) from
orders group by Eid order by count(*) desc limit 1)));
你没乘以price啊,你只看订单数量,不看订单金额的吗