SELECT O.OPRID , T.TREE_NAME , T.EFFDT , PJ.EMPLID , N.NAME_DISPLAY , N.LAST_NAME_SRCH , PJ.BUSINESS_UNIT , PJ.DEPTID , JC.DESCR FROM PSOPRDEFN O , PS_PRIMARY_JOB_VW PJ , PS_PERSON_NAME N , PSTREEDEFN T , PSTREENODE TN , PS_HRCD_JOB_TREE JT , PS_JOBCODE_TBL JC WHERE O.OPRTYPE = 0 AND PJ.EMPLID <> O.EMPLID AND T.TREE_NAME = TN.TREE_NAME AND T.EFFDT = TN.EFFDT AND PJ.EFFDT = ( SELECT MAX(EFFDT) FROM PS_JOB WHERE EMPLID = PJ.EMPLID AND EMPL_RCD = PJ.EMPL_RCD AND EFFDT <= %CurrentDateIn) AND PJ.EMPLID = N.EMPLID AND PJ.HR_STATUS = 'A' AND PJ.EFFDT <= T.EFFDT AND JT.EMPLID = PJ.EMPLID AND JT.EMPL_RCD = PJ.EMPL_RCD AND JT.TREE_NODE = TN.TREE_NODE AND JT.TREE_NODE = ( SELECT MIN(JT1.TREE_NODE) FROM PS_HRCD_JOB_TREE JT1 WHERE JT1.EMPLID = PJ.EMPLID AND JT1.EMPL_RCD = PJ.EMPL_RCD) AND PJ.SETID_JOBCODE = JC.SETID AND PJ.JOBCODE = JC.JOBCODE AND %EffdtCheck(JOBCODE_TBL JCE, JC, %CurrentDateIn) ORDER BY N.NAME_DISPLAY, JC.DESCR
|