云计算百科
云计算领域专业知识百科平台

570. 至少有5名直接下属的经理 题解

# Write your MySQL query statement below

select name

from(

    select e1.name,count(*) c

    from Employee e1

    cross join Employee e2

    on e1.id = e2.managerId and e1.id != e2.id

    group by e1.id

) e

where c >= 5

名字可能会相同,应该以id这个主键作为区分

赞(0)
未经允许不得转载:网硕互联帮助中心 » 570. 至少有5名直接下属的经理 题解
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!