PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

unisci tutte le colonne delle righe in un'unica colonna dalla tabella unita

SELECT a.parent_id, a.parent_name, STRING_AGG(b.child_name, ',') as Children
FROM
    Parent a
    INNER JOIN children b
    ON a.Id = b.ParentId
GROUP BY
    a.parent_id
    ,a.parent_name