SQL to pull the Terminated Employees

SQL to pull the Terminated Employees

SQL to pull the Terminated Employees


SELECT DISTINCT MGR_NUM1.PERSON_NUMBER TERMINATION_EMPLOYEE_NUMBER, 
POS.ACTUAL_TERMINATION_DATE TERMINATION_DATE,
MGR_PAPF.PERSON_NUMBER TERMINATION_MANAGER_NUMBER,	
PASUPF.MANAGER_TYPE,
MGR_PPNF.DISPLAY_NAME TERMINATED_MANAGER_NAME 

FROM PER_PERIODS_OF_SERVICE POS
,PER_ASSIGNMENT_SUPERVISORS_F PASUPF
,PER_ALL_PEOPLE_F MGR_PAPF
,PER_ALL_PEOPLE_F MGR_NUM1
,PER_PERSON_NAMES_F MGR_PPNF
,PER_PERSONS MGR_PP

WHERE POS.ACTUAL_TERMINATION_DATE IS NOT NULL 
AND POS.PERSON_ID = PASUPF.PERSON_ID
AND POS.ACTUAL_TERMINATION_DATE BETWEEN PASUPF.EFFECTIVE_START_DATE 
AND PASUPF.EFFECTIVE_END_DATE 
AND PASUPF.MANAGER_ID = MGR_PAPF.PERSON_ID 
AND POS.ACTUAL_TERMINATION_DATE BETWEEN MGR_PAPF.EFFECTIVE_START_DATE AND MGR_PAPF.EFFECTIVE_END_DATE 
AND MGR_NUM1.PERSON_ID = POS.PERSON_ID
AND POS.ACTUAL_TERMINATION_DATE BETWEEN MGR_NUM1.EFFECTIVE_START_DATE AND MGR_NUM1.EFFECTIVE_END_DATE 
AND PASUPF.MANAGER_ID = MGR_PPNF.PERSON_ID
AND MGR_PP.PERSON_ID=MGR_PPNF.PERSON_ID(+)

Leave a Reply

Your email address will not be published. Required fields are marked *