SELECT DISTINCT C.BUSINESS_UNIT , A.EMPLID , G.STRM , A.INSTITUTION , G.DESCR , ' ' , 0 FROM PS_ADM_APPL_PROG A , PS_BUS_UNIT_TBL_SF C , PS_ADM_APPL_DEP_PR D , PS_HOME_CAMPUS_TBL E , PS_ADM_APPL_DEP F , PS_TERM_VAL_TBL G WHERE D.EMPLID = F.EMPLID AND D.ADM_APPL_NBR = F.ADM_APPL_NBR AND D.APPL_DEP_NBR = F.APPL_DEP_NBR AND A.INSTITUTION = C.INSTITUTION AND A.ADMIT_TERM = G.STRM AND A.EFFDT = ( SELECT MAX(A1.EFFDT ) FROM PS_ADM_APPL_PROG A1 WHERE A.EMPLID = A1.EMPLID AND A.ACAD_CAREER = A1.ACAD_CAREER AND A.STDNT_CAR_NBR = A1.STDNT_CAR_NBR AND A.ADM_APPL_NBR = A1.ADM_APPL_NBR AND A.APPL_PROG_NBR = A1.APPL_PROG_NBR) AND A.EFFSEQ = ( SELECT MAX(A2.EFFSEQ ) FROM PS_ADM_APPL_PROG A2 WHERE A.EMPLID = A2.EMPLID AND A.ACAD_CAREER = A2.ACAD_CAREER AND A.STDNT_CAR_NBR = A2.STDNT_CAR_NBR AND A.ADM_APPL_NBR = A2.ADM_APPL_NBR AND A.APPL_PROG_NBR = A2.APPL_PROG_NBR AND A.EFFDT = A2.EFFDT) AND (A.PROG_STATUS = 'PM' OR A.PROG_STATUS = 'AD' OR A.PROG_STATUS = 'AC') AND A.EMPLID = D.EMPLID AND A.ADM_APPL_NBR = D.ADM_APPL_NBR AND A.ACAD_PROG = D.ACAD_PROG AND A.INSTITUTION = E.INSTITUTION AND A.ACAD_PROG = E.ACAD_PROG AND E.EFFDT = ( SELECT MAX(E1.EFFDT) FROM PS_HOME_CAMPUS_TBL E1 WHERE E.INSTITUTION = E1.INSTITUTION AND E.ACAD_PROG = E1.ACAD_PROG AND E.EFFDT <= %CurrentDateIn) AND A.CAMPUS = E.CAMPUS
|