SELECT B.BUSINESS_UNIT ,A.EMPLID ,A.SSF_IHC_COVER_NBR ,C.INSTITUTION ,D.NAME FROM PS_SSF_IHC_STDNT A ,PS_SSF_IHC_STDPAR B ,PS_BUS_UNIT_TBL_SF C , PS_SCC_PRI_NAME_VW D WHERE A.EMPLID = B.EMPLID AND B.BUSINESS_UNIT = C.BUSINESS_UNIT AND A.SSF_IHC_COVER_NBR = B.SSF_IHC_COVER_NBR AND A.EFF_STATUS = 'A' AND A.EFFDT <=%CurrentDateIn AND A.EFFSEQ = ( SELECT MAX (S2.EFFSEQ) FROM PS_SSF_IHC_STDNT S2 WHERE S2.EMPLID = A.EMPLID AND S2.SSF_IHC_COVER_NBR = A.SSF_IHC_COVER_NBR AND S2.EFFDT = A.EFFDT) AND B.EMPLID = D.EMPLID AND D.EFFDT = ( SELECT MAX(X.EFFDT) FROM PS_SCC_PRI_NAME_VW X WHERE X.EMPLID = D.EMPLID AND X.EFFDT <= %CurrentDateIn)
|