PostgreSQL json aggregation issue -


how postgres aggregation function merge 1 object element in array field in parent object.

what need

sector

sector

project

project

result

result

my sql request.

select row_to_json(t) ( select id, data, ( select array_to_json(array_agg(row_to_json(p))) ( select id, data public."project" (s.data -» 'projectid') :: uuid = id ) p ) projects public."sector" s ) t;

it don't work, because projects null. need, unwind data field , merge projectid in data project table. unwind , lookup in mongodb.


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -