Works well in local but wrong in leetcode


  • 0
    H

    Here is my code:

        SELECT
            d.Name AS Department,
            e.Name AS Employee,
            e.Salary AS Salary
        FROM Employee e JOIN Department d ON e.DepartmentId = d.Id
        WHERE NOT EXISTS (
            SELECT COUNT(s.Salary)
            FROM ( 
                SELECT DISTINCT DepartmentId, Salary FROM Employee
            ) s
            WHERE s.DepartmentId = e.DepartmentId AND s.Salary > e.Salary
            GROUP BY s.DepartmentId HAVING COUNT(s.Salary) > 2
        )
    

    And failed test case:

    Employee: [1, "Rudy", 0, 1]
    Department: [1, "Sales"]
    

    But the sql works well in local and returns ["Sales", "Rudy", 0], but in leetcode I get an wrong answer as it returns an empty result []

    Any ideas?


Log in to reply
 

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