我有两张桌子,
1)USER
id fullname email
1 abc a@a.com
2 def b@b.com
2)技能
id user_id skills
1 1 writer
2 1 blogger
3 2 singer
我希望得到像bellow一样的结果,
fullname email skills
abc a@a.com writer,blogger
答案 0 :(得分:0)
您可以在查询中使用array_agg()函数来获取结果。
Select fullname, email, array_agg(skills) from user left join skills on user.id = skills.user_id group by (fullname, email)