SELECT FY.LM_FCLTY_ID , FYL.LANGUAGE_CD , FYL.LM_FCLTY , CASE WHEN FY.STATE <> ' ' AND FY.CITY <> ' ' THEN FY.CITY %Concat ', ' %Concat FY.STATE WHEN FY.STATE = ' ' AND FY.CITY <> ' ' THEN FY.CITY WHEN FY.STATE = ' ' AND FY.CITY = ' ' THEN CTL.DESCR END FROM PS_LM_FCLTY_TBL FY , PS_LM_FCLTTBL_LANG FYL , PS_COUNTRY_TBL CT , PS_COUNTRYTBL_LANG CTL WHERE FY.LM_FCLTY_ID = FYL.LM_FCLTY_ID AND FY.COUNTRY = CT.COUNTRY AND FYL.LANGUAGE_CD = CTL.LANGUAGE_CD UNION SELECT FY.LM_FCLTY_ID , FYL.LANGUAGE_CD , FYL.LM_FCLTY , CASE WHEN FY.STATE <> ' ' AND FY.CITY <> ' ' THEN FY.CITY %Concat ', ' %Concat FY.STATE WHEN FY.STATE = ' ' AND FY.CITY <> ' ' THEN FY.CITY WHEN FY.STATE = ' ' AND FY.CITY = ' ' THEN CT.DESCR END FROM PS_LM_FCLTY_TBL FY , PS_LM_FCLTTBL_LANG FYL , PS_COUNTRY_TBL CT WHERE FY.LM_FCLTY_ID = FYL.LM_FCLTY_ID AND FY.COUNTRY = CT.COUNTRY AND NOT EXISTS ( SELECT 1 FROM PS_COUNTRYTBL_LANG CTL WHERE CT.COUNTRY = CTL.COUNTRY ) UNION SELECT FY.LM_FCLTY_ID , CTL.LANGUAGE_CD , FY.LM_FCLTY , CASE WHEN FY.STATE <> ' ' AND FY.CITY <> ' ' THEN FY.CITY %Concat ', ' %Concat FY.STATE WHEN FY.STATE = ' ' AND FY.CITY <> ' ' THEN FY.CITY WHEN FY.STATE = ' ' AND FY.CITY = ' ' THEN CTL.DESCR END FROM PS_LM_FCLTY_TBL FY , PS_COUNTRY_TBL CT , PS_COUNTRYTBL_LANG CTL WHERE FY.COUNTRY = CT.COUNTRY AND CT.COUNTRY = CTL.COUNTRY AND NOT EXISTS ( SELECT 1 FROM PS_LM_FCLTTBL_LANG FYL WHERE FY.LM_FCLTY_ID = FYL.LM_FCLTY_ID)
|