SELECT a.emplid , a.institution , a.strm , a.aid_year , b.descr FROM PS_STDNT_FA_TERM a , ps_term_val_tbl b WHERE a.strm=b.strm AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_STDNT_FA_TERM B WHERE B.EMPLID = A.EMPLID AND B.INSTITUTION = A.INSTITUTION AND B.AID_YEAR = A.AID_YEAR AND B.STRM = A.STRM AND B.EFFDT <= %CurrentDateIn) AND A.EFFSEQ = ( SELECT MAX(B1.EFFSEQ) FROM PS_STDNT_FA_TERM B1 WHERE B1.EMPLID = A.EMPLID AND B1.INSTITUTION = A.INSTITUTION AND B1.AID_YEAR = A.AID_YEAR AND B1.STRM = A.STRM AND B1.EFFDT = A.EFFDT) AND A.EFF_STATUS = 'A'
|