Two Straightforward way, using 'where' and 'join'


  • 7
    Z

    By the way, 'where' method took about 180 ms less time than 'join' method.

    Where:

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

    Join:

    select 
    e1.Name
    from Employee e1 join Employee e2
    on e1.ManagerId = e2.Id and e1.Salary>e2.Salary

  • 0
    K

    Isn't the first way the old fashion and should be deprecated?


Log in to reply
 

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