SELECT A.TRANSACTION_NBR , A.EMPLID , A.EMPL_RCD , A.SCH_TARGET_EMPLID , A.SCH_TARGET_EMPLRCD , NAM.NAME_DISPLAY , A.START_DATE , A.END_DATE , C.DESCR , D.DESCR FROM PS_SCH_REQ_SS_DAT A LEFT OUTER JOIN PS_SCH_EMP_SCHD_VW D ON A.SCH_TARGET_EMPLID=D.EMPLID AND A.SCH_TARGET_EMPLRCD = D.EMPL_RCD , PS_NAMES NAM , PS_JOB JOB , PS_JOBCODE_TBL C WHERE NAM.EMPLID = A.SCH_TARGET_EMPLID AND NAM.NAME_TYPE = 'PRI' AND NAM.EFFDT = ( SELECT MAX (NM1.EFFDT) FROM PS_NAMES NM1 WHERE NAM.EMPLID = NM1.EMPLID AND NM1.NAME_TYPE = NAM.NAME_TYPE AND NM1.EFFDT <= %CurrentDateIn) AND JOB.EMPLID = A.SCH_TARGET_EMPLID AND JOB.EMPL_RCD = A.SCH_TARGET_EMPLRCD AND JOB.SETID_JOBCODE = C.SETID AND JOB.JOBCODE = C.JOBCODE AND C.EFF_STATUS = 'A' AND %EffdtCheck(JOBCODE_TBL, C, %CurrentDateIn) AND JOB.EFFDT=( SELECT MAX(EFFDT) FROM PS_JOB JOB2 WHERE JOB.EMPLID=JOB2.EMPLID AND JOB.EMPL_RCD=JOB2.EMPL_RCD AND JOB2.EFFDT<=%CurrentDateIn) AND JOB.EFFSEQ = ( SELECT MAX(EFFSEQ) FROM PS_JOB WHERE EMPLID = JOB.EMPLID AND EMPL_RCD = JOB.EMPL_RCD AND EFFDT = JOB.EFFDT)
|