SELECT DISTINCT P.EMPLID ,B.EMPL_RCD ,O.OPRID FROM PS_PERSON P ,PSOPRDEFN O ,PS_JOB B ,PS_GPJP_IT_PYE_TAX C WHERE O.EMPLID=P.EMPLID AND B.EMPLID = O.EMPLID AND C.EMPLID = B.EMPLID AND C.EMPL_RCD = ( SELECT D.EMPL_RCD FROM PS_GPJP_IT_PYE_TAX D WHERE D.EMPLID = C.EMPLID AND D.EMPL_RCD = C.EMPL_RCD AND D.EFFDT = C.EFFDT AND B.PAY_SYSTEM_FLG = 'GP' AND D.GPJP_IT_TYPE = '10') AND C.EMPL_RCD=B.EMPL_RCD AND C.EFFDT = ( SELECT MAX(EFFDT) FROM PS_GPJP_IT_PYE_TAX E WHERE E.EMPLID = C.EMPLID AND E.EMPL_RCD=C.EMPL_RCD) AND B.EFFDT =( SELECT MAX(EFFDT) FROM PS_JOB WHERE EMPLID = B.EMPLID AND EMPL_RCD = B.EMPL_RCD AND B.HR_STATUS = 'A') AND B.EFFSEQ = ( SELECT MAX(EFFSEQ) FROM PS_JOB F WHERE F.EMPLID=B.EMPLID AND F.EMPL_RCD = B.EMPL_RCD AND F.EFFDT = B.EFFDT )
|