SELECT A.EMPLID , A.REPORTS_TO , A.SUPERVISOR_ID FROM %Table(JOB) A WHERE A.EFFDT = ( SELECT MAX(A2.EFFDT) FROM %Table(JOB) A2 WHERE A.EMPLID = A2.EMPLID AND A.EMPL_RCD = A2.EMPL_RCD AND A2.EFFDT <= %CurrentDateIn) AND A.EFFSEQ = ( SELECT MAX(A3.EFFSEQ) FROM %Table(JOB) A3 WHERE A.EMPLID = A3.EMPLID AND A.EMPL_RCD = A3.EMPL_RCD AND A.EFFDT = A3.EFFDT) AND A.EMPL_RCD = ( SELECT MAX(C.EMPL_RCD) FROM %Table(RS_WRKR_EFFDT) C WHERE C.EMPLID = A.EMPLID AND C.EFFDT = ( SELECT MAX(CC.EFFDT) FROM %Table(RS_WRKR_EFFDT) CC WHERE C.EMPLID = CC.EMPLID AND C.SYSTEM_SOURCE = CC.SYSTEM_SOURCE AND CC.EFFDT <= %CurrentDateIn))
|