テーブルを結合してarray_agg
を使用できます カンマで区切られた値を組み合わせる
SELECT a.id, array_agg(b.name) assignments
FROM Project a
INNER JOIN assignment b
ON a.id = b.project_ID
GROUP BY a.id
SQLFiddleデモ
またはSTRING_AGG
を使用します
SELECT a.id, STRING_AGG(b.name, ', ' ORDER BY b.name) assignments
FROM Project a
INNER JOIN assignment b
ON a.id = b.project_ID
GROUP BY a.id