leetcode-Database-181 |超过经理收入的员工

原题

在这里插入图片描述

分析

关键在于原题,每个员工对应有一个经理,要找的是大于自己经理的员工。

代码

select e1.Name as Employee
from Employee e1,Employee e2
where 
e1.ManagerId=e2.ID
and e1.Salary>e2.Salary
and e1.ManagerId is not null

猜你喜欢

转载自blog.csdn.net/qq_38173650/article/details/114694522