Test data:
create temp table l (id integer,name text); create temp table t (id integer); create temp table t_i18n(id integer,l_id integer,t_id integer,name text); insert into l(id, name) values (1, 'lang_1'), (2, 'lang_2'); insert into t(id) values(1); insert into t_i18n(id, l_id, t_id, name) values (1, 1, 1, 'Text in the language one'), (2, 2, 1, 'Text in the language two');
After executing this request:
select * from t inner join t_i18n i18n on i18n.t_id = t.id;
I have this result:
id | id | l_id | t_id | name ----+----+------+------+-------------------------- 1 | 1 | 1 | 1 | Text in the language one 1 | 2 | 2 | 1 | Text in the language two
Is it possible to modify the query above to get the result below?
id | name_lang_1 | name_lang_2 ----+--------------------------+-------------------------- 1 | Text in the language one | Text in the language two
source share