Content |
select e.lv, m.first_name as manager, listagg(e.first_name, ',') within group(order by e.first_name) as member
from (
select employee_id, first_name, manager_id, level as lv
from employees
start with manager_id is null
connect by prior employee_id=manager_id
) e
join employees m
on e.manager_id=m.employee_id
group by e.lv, m.first_name
order by e.lv;
|