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

aggregato json postgresql

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