首页 > 其他分享 >leetcode 570 至少有5名直接下屬的經理

leetcode 570 至少有5名直接下屬的經理

时间:2023-04-25 14:45:40浏览次数:38  
标签:下屬 570 managerId Employee 經理 e1 id e2

至少有5名直接下屬的經理

 

子查詢

select `name` from Employee where id in (
    select managerId from Employee 
    group by managerId
    having count(managerId) >= 5
) 

 

自連接

select e2.name from Employee e1 ,Employee e2
where e1.managerId = e2.id
group by e2.id
having count(e1.id) >= 5

 

=

标签:下屬,570,managerId,Employee,經理,e1,id,e2
From: https://www.cnblogs.com/carlzhang19/p/17352503.html

相关文章