SELECT C1.COMPANY , C1.DESCR FROM %Table(COMPANY_TBL) C1 WHERE C1.EFFDT = ( SELECT MAX(C2.EFFDT) FROM %Table(COMPANY_TBL) C2 WHERE C1.COMPANY = C2.COMPANY AND C2.EFFDT <= %CurrentDateIn) AND C1.EFF_STATUS = 'A' AND EXISTS ( SELECT 'X' FROM %Table(EOTF_DVMVALS_VW) DV , %Table(EOTF_ELEMENTS) EL , %Table(EOTF_ELEMENTSET) ES , %Table(FT_INSTALL) FT WHERE DV.EOTF_MAP_NAME = 'LEGAL_ENTITY_XREF' AND DV.EOTF_ELEMENT_VALUE = C1.COMPANY AND ES.EOTF_DOMAIN_NAME = FT.FT_DOMAIN_SOURCE AND %Join(COMMON_FIELDS, EOTF_DVMVALS_VW DV, EOTF_ELEMENTS EL) AND %Join(COMMON_KEYS, EOTF_ELEMENTS EL, EOTF_ELEMENTSET ES))
|