I have a table with 3 columns: label_value, language_value, language. It’s table for labels, where label_value = "name" of the label, language_value – translation of the label, language – id of language which is using. So, I need to extract label_value, language_value for English (language=45) and language_value for my language(language=24). Please, note, that not all English labels has translation to my language, but I need to extract all English labels and if the label has no translation to my English then it must return this label with NULL language_value for my language. So, I have made the following code:
SELECT e.label_value, e.language_value
FROM labels e, labels t
WHERE e.label_value=t.label_value AND e.language=45 AND t.language=24
I understand that it’s not full and right query, because it hasn’t returned not all English labels and returned some labels 2 times. Please, edit it. Thank you.
UPDATED:
Also I need that queries for locale satisfy the condition: t.approved=’1′ or t.user_id=123.
You can use a
left jointo look up the optional local-language row: