Write a query to display manager and employees under them?

VijayaTech Labs Blog

select manager,count(employee),
rtrim(xmlagg(xmlelement(e,employee||’,’)).extract(‘//text()’),’,’) as “Employees under the Manager”
from (select e2.first_name manager,e1.first_name employee
from employee e1,employee e2
where e1.reporting_to=e2.employeeid)
group by manager;

Share this post with your friends

Leave a Comment

Your email address will not be published.

Scroll to Top