本文最后更新于 134 天前。
关键:WHERE (departmentId, salary) IN (… …)
SELECT Department.name Department, Employee.name Employee, salary Salary
FROM Employee JOIN Department ON Employee.departmentId = Department.id
WHERE (departmentId, salary) IN (
SELECT departmentId, MAX(salary)
FROM Employee
GROUP BY departmentId
);