SELECT DISTINCT E.INSTITUTION , E.AID_YEAR , B.TIV_SCHOOL_CODE , D.OWNING_SCHOOL_CD , E.EMPLID , A.NAME FROM PS_HCR_PERSON_NM_I A , PS_ISIR_CONTROL D , PS_STDNT_AID_ATRBT E , PS_PELL_PMT_OPTION B WHERE A.EMPLID = D.EMPLID AND D.EMPLID = E.EMPLID AND D.INSTITUTION = E.INSTITUTION AND D.AID_YEAR = E.AID_YEAR AND E.PELL_PROCESS_FIELD = 'P' AND D.EFFDT = ( SELECT MAX(D1.EFFDT) FROM PS_ISIR_CONTROL D1 WHERE D1.EMPLID = D.EMPLID AND D1.INSTITUTION = D.INSTITUTION AND D1.AID_YEAR = D.AID_YEAR AND D1.EFFDT <= %CurrentDateIn) AND D.EFFSEQ = ( SELECT MAX(D2.EFFSEQ) FROM PS_ISIR_CONTROL D2 WHERE D2.EMPLID = D.EMPLID AND D2.INSTITUTION = D.INSTITUTION AND D2.AID_YEAR = D.AID_YEAR AND D2.EFFDT = D.EFFDT) AND B.INSTITUTION = D.INSTITUTION AND B.INSTITUTION = E.INSTITUTION AND B.AID_YEAR = D.AID_YEAR AND B.AID_YEAR = E.AID_YEAR AND D.OWNING_SCHOOL_CD IN ( SELECT C.PELL_ID_ATTENDED FROM PS_PELL_ATTENDING C WHERE C.INSTITUTION = B.INSTITUTION AND C.INSTITUTION = E.INSTITUTION AND C.INSTITUTION = D.INSTITUTION AND C.AID_YEAR = B.AID_YEAR AND C.AID_YEAR = E.AID_YEAR AND C.AID_YEAR = D.AID_YEAR AND C.TIV_SCHOOL_CODE = B.TIV_SCHOOL_CODE)
|