SELECT DEL.INSTITUTION ,DEL.SSR_RI_EDU_GOV_NLD ,DEL.LOCATION FROM PS_SSR_RI_MOLO_NLD DEL UNION SELECT A.INSTITUTION ,A.SSR_RI_EDU_GOV_NLD ,B.LOCATION FROM PS_SSR_RI_EPS_NLD A , PS_LOCATION_TBL B , PS_SET_CNTRL_REC C ,PS_SSR_RI_OLWL_NLD OLW WHERE A.INSTITUTION = C.SETCNTRLVALUE AND C.RECNAME = 'LOCATION_TBL' AND C.SETID = B.SETID AND B.EFFDT = ( SELECT MAX(B_ED.EFFDT) FROM PS_LOCATION_TBL B_ED WHERE B_ED.LOCATION = B.LOCATION AND B_ED.EFFDT <= %CurrentDateIn) AND %EffdtCheck(SSR_RI_EPS_NLD A_ED, A,%currentdatein) AND A.INSTITUTION = OLW.INSTITUTION AND B.LOCATION = OLW.LOCATION AND A.EFFDT = OLW.EFFDT
|