What is wrong with this code?


  • 0
    S

    SELECT A.name as Department, E.Name as Employee, Salary

    From Employee AS E

    LEFT JOIN

    (SELECT MAX(Salary) as Max_Sal, D.Name, D.ID

    FROM Employee AS E
    
    LEFT JOIN Department D
    
    ON E.DepartmentId=D.Id
    
    GROUP BY D.ID, D.Name) AS A
    

    ON (A.Max_Sal = E.Salary and A.ID=E.DepartmentId)

    THANX :)


Log in to reply
 

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