1731. 每位经理的下属员工数量
题目链接:1731. 每位经理的下属员工数量
代码如下:
# Write your MySQL query statement below
select
a.employee_id as employee_id,
a.name as name,
count(b.employee_id) as reports_count,
round(avg(b.age),0) as average_age
from
Employees as a
left join
Employees as b
on
a.employee_id=b.reports_to
where
b.reports_to is not null
group by a.employee_id
order by a.employee_id
标签:每位,1731,age,reports,id,employee,下属
From: https://blog.csdn.net/weixin_45256307/article/details/139564229