SELECT DISTINCT r.institution , i.descr FROM ps_ssr_aptsyrq_dtl r ,ps_institution_tbl i WHERE i.institution = r.institution AND i.effdt = ( SELECT MAX(i2.effdt) FROM ps_institution_tbl i2 WHERE i2.institution = i.institution AND i2.effdt <= %CurrentDateIn) AND i.eff_status = 'A' UNION SELECT DISTINCT t.institution , i.descr FROM PS_SSR_APT_SYN_TRK t ,ps_institution_tbl i WHERE i.institution = t.institution AND i.effdt = ( SELECT MAX(i2.effdt) FROM ps_institution_tbl i2 WHERE i2.institution = i.institution AND i2.effdt <= %CurrentDateIn) AND i.eff_status = 'A'
|