Medium - Q2

mail@pastecode.io avatar
unknown
sql
2 years ago
572 B
5
Indexable
Never
select company.company_code,company.founder, count(distinct lead_manager.lead_manager_code),
count(distinct senior_manager.senior_manager_code), count(distinct manager.manager_code), 
count(distinct employee.employee_code) from Company, Lead_Manager, Senior_Manager, Manager, Employee where company.company_code=lead_manager.company_code and lead_manager.company_code=senior_manager.company_code and senior_manager.company_code=manager.company_code and manager.company_code=employee.company_code
group by company.company_code,company.founder order by company.company_code;