SELECT DEL.INSTITUTION ,DEL.SSR_RIO_PRG_UUID FROM PS_SSR_RI_MOPR_NLD DEL UNION SELECT DISTINCT A.INSTITUTION , B.SSR_RIO_PRG_UUID FROM PS_SSR_RI_EPS_NLD A ,PS_SSR_RIO_PRG_NLD B ,PS_SCC_CMPLOAD_NLD C ,PS_ACAD_PROG_TBL D ,PS_SCC_HM_CAMP_NLD E WHERE A.INSTITUTION = B.INSTITUTION AND %EffdtCheck(SSR_RI_EPS_NLD A_ED, A, %CURRENTDATEIN) AND B.INSTITUTION = C.INSTITUTION AND B.ACAD_PROG = C.ACAD_PROG AND B.CAMPUS = C.CAMPUS AND B.ACAD_LOAD_APPR = C.ACAD_LOAD_APPR AND B.ACAD_ORG = E.ACAD_ORG AND D.INSTITUTION = B.INSTITUTION AND D.ACAD_PROG = B.ACAD_PROG AND D.EFFDT = ( SELECT MAX(D_ED.EFFDT) FROM PS_SCC_CMPLOAD_NLD D_ED WHERE B.INSTITUTION = D_ED.INSTITUTION AND B.ACAD_PROG = D_ED.ACAD_PROG AND D_ED.EFFDT <= %CurrentDateIn) AND C.EFFDT = D.EFFDT AND E.INSTITUTION = D.INSTITUTION AND E.ACAD_PROG = D.ACAD_PROG AND E.CAMPUS = B.CAMPUS AND E.EFFDT = D.EFFDT
|