SELECT B.AUTHORIZED_OPRID , A.EMPLID , A.NAME FROM PS_PERSONAL_DATA A , PS_EX_EE_AUTH_TBL B , PS_JOB C WHERE B.EMPLID = A.EMPLID AND C.EMPLID = A.EMPLID AND C.EFFDT = ( SELECT MAX(C1.EFFDT) FROM PS_JOB C1 WHERE C1.EMPLID = C.EMPLID AND C1.EMPL_RCD = C.EMPL_RCD AND C1.EFFDT <= %CurrentDateIn) AND C.EFFSEQ = ( SELECT MAX(C2.EFFSEQ) FROM PS_JOB C2 WHERE C2.EMPLID = C.EMPLID AND C2.EMPL_RCD = C.EMPL_RCD AND C2.EFFDT = C.EFFDT) AND C.EMPL_RCD = ( SELECT MIN(D.EMPL_RCD) FROM PS_JOB D WHERE D.EMPLID = C.EMPLID AND D.EFFDT = ( SELECT MAX(J3.EFFDT) FROM PS_JOB J3 WHERE J3.EMPLID = D.EMPLID AND J3.EMPL_RCD = D.EMPL_RCD AND J3.EFFDT <= %CurrentDateIn) AND D.EFFSEQ = ( SELECT MAX(J4.EFFSEQ) FROM PS_JOB J4 WHERE J4.EMPLID = D.EMPLID AND J4.EMPL_RCD = D.EMPL_RCD AND J4.EFFDT = D.EFFDT) AND D.EMPL_STATUS IN ('A','L','P','S','W') ) AND C.EMPL_STATUS IN ('A','L','P','S','W')
|