Hello,
I have three tables: Company, Personal, and Personal1. Personal1 is only used to add an email address for supervisors listed in Company, hence the left joins below. I run a report weekly to upload into one of our systems, and I realized that our CEO has been left out since he has no supervisor in our HRIS. I can't add a value to company.Supervisorname for him, or another record to personal1, because of how delicate the upload system is. Below is my query - do you have any tips for adding his record as well?
Code:
SELECT '[my company's name]' AS company_name, personal.emailaddress AS user_login, personal.eename AS user_name, personal1.emailaddress AS manager_login, company.jobtitle AS user_title, company.orglevel2 AS user_department, company.location, personal.lasthiredate AS hire_date, personal.employeenumber AS external_uuidFROM (personal
INNER JOIN Company
ON personal.employeenumber = company.employeenumber)
LEFT JOIN Personal1 ON company.supervisorname = personal1.eename
WHERE personal.employmentstatuscode = 'A'