我的员工表结构如下图所示
下面的查询根据部门平均最高工资获取部门ID
SELECT dep_id
FROM employee
GROUP BY dep_id
ORDER BY AVG( salary ) DESC
LIMIT 1
输出
dep_id
2
但我在更新查询中遇到问题
UPDATE employee
SET salary = salary +1000
where dep_id = (
SELECT dep_id
FROM employee
GROUP BY dep_id
ORDER BY AVG( salary ) DESC
LIMIT 1
)