We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
with cte_emp as (
select company_code,count(distinct lead_manager_code) as lmc,count(distinct senior_manager_code) as smc,
count(distinct manager_code) as mc,count(distinct employee_code) as ec from employee group by company_code
)select a.company_code,b.founder,a.lmc,a.smc,a.mc,a.ec
from cte_emp a join company b on a.company_code = b.company_code
order by a.company_code
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
New Companies
You are viewing a single comment's thread. Return to all comments →
in MS sql
with cte_emp as ( select company_code,count(distinct lead_manager_code) as lmc,count(distinct senior_manager_code) as smc, count(distinct manager_code) as mc,count(distinct employee_code) as ec from employee group by company_code )select a.company_code,b.founder,a.lmc,a.smc,a.mc,a.ec from cte_emp a join company b on a.company_code = b.company_code order by a.company_code