I have a request of translation:
(table structure:
- line_id
- lang (“en” or “ru”)
- text
so, in the table it looks like:
5 | en | Test
6 | en | Hello!
7 | en | Another words
6 | ru | Привет!
and all translations are in the same table with key line_id, that is independent from the language)
SELECT txt.line_id, txt.text AS o, ru.text AS t
FROM text AS txt, text AS ru
WHERE txt.line_id = ru.line_id
AND txt.lang = 'en';
it will return such array
> [5] => Array ( [line_id] => 5 [o] => Test [t] => Test
> [6] => Array ( [line_id] => 6 [o] => Hello! [t] => Hello! )
> [7] => Array ( [line_id] => 6 [o] => Hello! [t] => Привет! )
o – is original text, t – translation.
How to delete from set #6 row, because we have translation in the next row. GROUP BY will kill #7 and save #6 row.
the best result would be:
> [5] => Array ( [line_id] => 5 [o] => Test [t] => )
> [6] => Array ( [line_id] => 6 [o] => Hello! [t] => Привет! )
without [o] => Hello! [t] => Hello!
I’m just guessing you probably need: