Skip to content
Advertisement

pgsql merge two json arrays

I have to select two type of result set from a table and merge them in single json array like

Its saying syntax error I believe due to order by.

I need to return this in json array so I am trying like this

Its retiring two json arrays i.e. obvious, How can I make this in single array

Thanks,

Advertisement

Answer

Do the aggregation after the UNION:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement