My simple solution

  • 0

    635 ms:

    select t3.Name as Department, t2.Name as Employee, t1.Salary as Salary
        select max(Salary) as Salary, DepartmentId
        from Employee
        group by DepartmentId
    ) t1, Employee t2, Department t3
    where t1.Salary = t2.Salary and t1.DepartmentId = t2.DepartmentId and t1.DepartmentId = t3.Id

Log in to reply

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