Join statement with nested select

14 views Asked by At

Trying to do the following on hackerrank question, what am I doing wrong.

select 
a.company_code, a.founder, a.lead_mang, a.sen_mang, a.mang, a.emp 
from
(select 
distinct company_code, 
founder, 
(count(distinct lead_manager_code) over (partition by company_code)) lead_mang, 
(count(distinct senior_manager_code) over (partition by company_code)) sen_mang, 
(count(distinct manager_code) over (partition by company_code)) mang, 
(count(distinct employee_code) over (partition by company_code)) emp 
from Employee e 
LEFT JOIN Company c on e.company_code = c.company_code) a 
order by a.company_code;`
0

There are 0 answers