I have a table with products with names in different languages:
product-id | lang-no | name
Now I want to generate product lists with names in each language. Unfortunately I don't have all names in all languages and must fall back to other languages if the right one isn't availabe.
Getting a list with a name in any language is easy:
SELECT DISTINCT product-id, name FROM mytable;
Is it defined which row gets picked by the database for the distinct product-id ? (MySQL in my case.)
How can I generate a list for language 1 and one for language 2 ?
Bonus: Can I define which language to fall back on ?
So my initial query is wrong. (Thanks!)
My list needs to include all products.
SELECT DISTINCT product-id FROM mytable
Now I need to add the names, preferrablx in one language, but no one language covers all products.