Why Syntax Error: near '(PARTITION BY Department ORDER BY Salary DESC)


  • 0
    J

    select Department, Name, Salary
    FROM (
    SELECT *, ROW_NUMBER() OVER (PARTITION BY b.Department ORDER BY b.Salary DESC) AS rn
    FROM
    (SELECT d.Name as Department, e.Name as Employee, e.Salary as Salary FROM Department d, Employee e where e.DepartmentID = d.ID)b
    ) a
    WHERE a.rn < 2


Log in to reply
 

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