657 ms

  • 1

    SELECT d.Name Department, e.Name Employee, e.Salary Salary FROM Department d INNER JOIN (
    SELECT Name, e.Salary, e.DepartmentId FROM Employee e INNER JOIN (SELECT MAX(Salary) Salary, DepartmentId FROM Employee GROUP BY DepartmentId) s ON e.Salary = s.Salary AND e.DepartmentId = s.DepartmentId
    ) AS e ON d.Id = e.DepartmentId

  • 0


Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.