Accepted Runtime: 1037 ms


  • 0
    L
    SELECT d.name AS Department,
           e.name AS Employee,
           xy.Salary
    FROM
      (SELECT max(Salary) AS Salary,
                             DepartmentId 
       FROM Employee e
       GROUP BY DepartmentId ) xy
    INNER JOIN Employee e ON e.Salary = xy.Salary
    AND e.DepartmentId  = xy.DepartmentId 
    INNER JOIN Department d ON xy.DepartmentId  = d.id

Log in to reply
 

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