Concise solution with WHERE and IN


  • 0
    T
    SELECT d.Name AS Department, e.Name AS Employee, e.Salary AS Salary
    FROM Department d, Employee e
    WHERE e.DepartmentId = d.Id AND e.Salary IN (SELECT MAX(Salary) FROM Employee WHERE DepartmentId = d.Id)
    

Log in to reply
 

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