I have a multi-lingual table for the country like this:
--------------------------------------------------------------------
country | lang | name
--------------------------------------------------------------------
US | en-US | United States
--------------------------------------------------------------------
US | fr | États-Unis
--------------------------------------------------------------------
US | ar | الولايات المتحدة
--------------------------------------------------------------------
US | de |
--------------------------------------------------------------------
I want to select the field "name" for the country 'US' for the lang 'de' but if the name field is empty fallback to the language 'en-US'.
so will a query like this should be correct:
select name from countries where country='US' and name<>"" and lang in ('de', 'en-US')
I really need optimized query.