SELECT DISTINCT A.JPM_CAT_SETID , %Substring(JPM_RLAT_KEY1 ,1,6) , B.DESCR FROM PS_JPM_JP_X_RLAT A , PS_JOB_TASK_TBL B WHERE A.EFFDT = ( SELECT MAX(EFFDT) FROM PS_JPM_JP_X_RLAT D WHERE A.JPM_PROFILE_ID = JPM_PROFILE_ID AND A.JPM_RLAT_NAME = JPM_RLAT_NAME AND A.JPM_CAT_SETID = JPM_CAT_SETID AND A.JPM_RLAT_KEY1 = JPM_RLAT_KEY1 AND D.EFFDT <= %CurrentDateIn) AND A.JPM_RLAT_KEY1 = B.JOB_TASK AND A.JPM_CAT_SETID = B.SETID AND B.EFFDT = ( SELECT MAX(EFFDT) FROM PS_JOB_TASK_TBL C WHERE C.JOB_TASK = B.JOB_TASK AND C.SETID = B.SETID AND C.EFFDT <= %CurrentDateIn) AND B.EFF_STATUS = 'A' AND A.EFF_STATUS = 'A' AND A.JPM_RLAT_NAME = 'JOB_TASK'
|