test=*# select * from texte ;
id | language | content
----+----------+----------
1 | de | deutsch
1 | en | englisch
1 | ru | russisch
2 | en | englisch
(4 rows)
Time: 0,157 ms
test=*# select content from texte where id = 1 and language in ('de','en') order by case when language = 'de' then 0 else 1 end limit 1;
content
---------
deutsch
(1 row)
Time: 0,318 ms
test=*# select content from texte where id = 2 and language in ('de','en') order by case when language = 'de' then 0 else 1 end limit 1;
content
----------
englisch
(1 row)