SELECT JOB.EMPLID , JOB.JOBCODE , JT.DESCR FROM PS_JOB JOB , PS_JOBCODE_TBL JT WHERE JOB.EFFDT = ( SELECT MAX(a.EFFDT) FROM PS_JOB a WHERE a.EMPLID = JOB.EMPLID AND a.EMPL_RCD = JOB.EMPL_RCD AND a.EFFSEQ = JOB.EFFSEQ AND a.EFFDT <= %CurrentDateIn) AND JOB.EFFSEQ = ( SELECT MAX(b.EFFSEQ) FROM PS_JOB b WHERE b.EMPLID = JOB.EMPLID AND b.EMPL_RCD = JOB.EMPL_RCD AND b.EFFDT = JOB.EFFDT ) AND JT.EFFDT = ( SELECT MAX(c.EFFDT) FROM PS_JOBCODE_TBL c WHERE c.SETID = JT.SETID AND c.JOBCODE = JT.JOBCODE AND c.EFF_STATUS = 'A' AND c.EFFDT <= %CurrentDateIn) AND JOB.JOB_INDICATOR = 'P' AND JOB.JOBCODE = JT.JOBCODE
|