SELECT X.EMPLID , X.EMPL_RCD , X.DUR , X.SEQ_NBR , U.OPRID , ( SELECT N.NAME FROM PSOPRDEFN O , PS_NAMES N WHERE O.OPRID = U.OPRID AND N.EMPLID = O.EMPLID AND N.NAME_TYPE = 'PRI' AND N.effdt = ( SELECT MAX(N1.effdt) FROM PS_NAMES N1 WHERE N1.EMPLID = N.EMPLID AND N1.NAME_TYPE = N.NAME_TYPE AND N1.effdt <= %CurrentDateIn)) FROM PS_TL_APP_PAY_XRF X , PS_EOAW_STEPINST S , PS_EOAW_USERINST U WHERE X.EOAWTHREAD_ID = S.EOAWTHREAD_ID AND X.EOAWPRCS_ID = S.EOAWPRCS_ID AND S.EOAWSTEP_INSTANCE = U.EOAWSTEP_INSTANCE AND X.TRANSACTIONID = ( SELECT MAX(TRANSACTIONID) FROM PS_TL_APP_PAY_XRF SUB WHERE SUB.EMPLID=X.EMPLID AND SUB.EMPL_RCD=X.EMPL_RCD AND SUB.DUR=X.DUR AND SUB.SEQ_NBR=X.SEQ_NBR) AND X.EOAWTHREAD_ID = ( SELECT MAX(EOAWTHREAD_ID) FROM PS_TL_APP_PAY_XRF SUB WHERE SUB.EMPLID=X.EMPLID AND SUB.EMPL_RCD=X.EMPL_RCD AND SUB.DUR=X.DUR AND SUB.SEQ_NBR=X.SEQ_NBR AND SUB.TRANSACTIONID = X.TRANSACTIONID)
|