create temp table tmp_apps (
id integer
);
create temp table tmp_pos (
tmp_apps_id integer,
position integer
);
insert into tmp_apps
select 1 id union
select 2 id
;
insert into tmp_pos (tmp_apps_id, position)
select 1 tmp_apps_id, 1 as position union all
select 1 tmp_apps_id, 1 as position union all
select 1 tmp_apps_id, 2 as position union all
select 1 tmp_apps_id, 3 as position union all
select 1 tmp_apps_id, 3 as position union all
select 2 tmp_apps_id, 1 as position
;
/*
Expected result:
tmp_apps_id tmp_pos_position
1 1,2
2 1
*/
Comment obtenir d'abord séparé par des virgules 2, tmp_pos.position
distincte pour chaque tmp_apps.id
Il est possible?postgresql requête de sélection
+1 pour un test de fonctionnement. * C'est * comment vous rendre plus facile de vous aider. –