select IFNULL(t2.name, t1.name) finalName from t t1 left join t t2 on (t1.city_id = t2.city_id and t2.lang_id = 'ru') where t1.lang_id = 'en'
SELECT max(name) FROM cities c
where c.lang_id in ("ru","en")
group by c.city_id;
SELECT
t.city_id,
COALESCE(cru.lang_id, cen.lang_id) AS lang_id,
COALESCE(cru.`name`, cen.`name`) AS `name`
FROM (
SELECT city_id FROM city
WHERE lang_id IN('ru', 'en')
GROUP BY city_id
) AS t
LEFT JOIN city AS cru ON cru.city_id = t.city_id AND cru.lang_id = 'ru'
LEFT JOIN city AS cen ON cen.city_id = t.city_id AND cen.lang_id = 'en'