Why my solution is not passed


  • 0
    K

    SELECT
    t3.Name as Department,
    t1.Name Employee,
    t1.Salary Salary
    FROM
    Employee t1
    INNER JOIN (
    SELECT
    a.DepartmentId,
    a.Salary
    FROM
    Employee a
    LEFT JOIN Employee b ON a.DepartmentId = b.DepartmentId
    AND a.Salary <= b.Salary
    GROUP BY
    a.DepartmentId,
    a.Salary
    HAVING
    count(b.Salary) <= 3
    ) t2 ON t1.DepartmentId = t2.DepartmentId
    AND t1.Salary = t2.Salary
    INNER JOIN Department t3 ON t1.DepartmentId = t3.Id
    ORDER BY
    t1.DepartmentId,
    t1.Salary DESC


Log in to reply
 

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