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
ona.employee_id=b.reports_to
whereb.reports_to is not null
group by a.employee_id
order by a.employee_id