My 1040ms Solution

  • 0

    SELECT d.Name, e1.Name, e1.Salary
    FROM Employee e1
    JOIN (
    SELECT Max(e.Salary) maxSalary,e.DepartmentId departmentId
    FROM Employee e
    GROUP BY e.DepartmentId) temp
    ON e1.departmentId = temp.departmentId
    AND e1.Salary = temp.maxSalary
    JOIN Department d
    ON d.Id = temp.departmentId

Log in to reply

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