https://leetcode-cn.com/problems/department-highest-salary/
求组内最大值,可以不使用exist,in前面可以用的多个字段筛选。
SELECT Department.name AS 'Department', Employee.name AS 'Employee', Salary FROM Employee JOIN Department ON Employee.DepartmentId = Department.Id WHERE (Employee.DepartmentId , Salary) IN ( SELECT DepartmentId, MAX(Salary) FROM Employee GROUP BY DepartmentId ) ;