SELECT DISTINCT PPS.CAL_RUN_ID , A.COMPANY , B.DESCR , PPS.PYMT_DT FROM PS_GP_PYE_PRC_STAT PPS , PS_JOB A , PS_COMPANY_TBL B WHERE PPS.CALC_TYPE = 'P' AND PPS.EMPLID = A.EMPLID AND PPS.SEL_STAT IN ('A','I') AND A.COMPANY = B.COMPANY AND A.EFFDT = ( SELECT MAX(A1.EFFDT) FROM PS_JOB A1 WHERE A1.EMPLID = PPS.EMPLID AND A1.EFFSEQ = A1.EFFSEQ AND A1.EMPL_RCD = A.EMPL_RCD AND A1.EFFDT <= %CurrentDateIn) AND A.EFFSEQ = ( SELECT MAX(A1.EFFSEQ) FROM PS_JOB A1 WHERE A1.EMPLID = PPS.EMPLID AND A1.EFFDT = A1.EFFDT AND A1.EMPL_RCD = A.EMPL_RCD)
|