Untitled

 avatar
user_9914919852
mysql
2 years ago
570 B
2
Indexable
Never
SELECT COMPANY.company_code, COMPANY.founder,

  (SELECT COUNT(DISTINCT lead_manager_code) FROM LEAD_MANAGER WHERE LEAD_MANAGER.company_code = COMPANY.company_code),
  
  (SELECT COUNT(DISTINCT senior_manager_code) FROM SENIOR_MANAGER WHERE SENIOR_MANAGER.company_code = COMPANY.company_code),
  
  (SELECT COUNT(DISTINCT manager_code) FROM MANAGER WHERE MANAGER.company_code = COMPANY.company_code),
  
  (SELECT COUNT(DISTINCT employee_code) FROM EMPLOYEE WHERE EMPLOYEE.company_code = COMPANY.company_code)
  
FROM COMPANY ORDER BY COMPANY.company_code ASC;