Regarding: Where and On solutions for "Employees earning more than their Managers"


  • 0
    A

    Re: [Two Straightforward way](using 'where' and 'join')

    I tried both the JOIN and the WHERE method but both are judged wrong by leetcode.
    Any idea why this may be the case?

    from Employee e1, Employee e2
    where e1.ManagerId = e2.Id
    and e1.Salary > e2.Salary
    

    Also, I've a random question if you don't mind.
    At first, I had the where/on clause flipped so it read
    ```where e1.Id = e2.ManagerId``

    Why should it be the other way?`


  • 0
    N

    Try this in the select : "Select e1.Name AS Employee".
    Leet is expected a column name "Employee" in the results... I had the same issue


Log in to reply
 

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