postgresql json aggregate postgresql json aggregate json json

postgresql json aggregate


select  pid,  json_agg(json_build_object('code',code,'name',name))from  ...group by  pid


SELECT pid from activity a, (    select json_agg(project) from project where code = a.code ) as p

Something like that ...