Reputation: 88
I have the following question: If I have this data in a table:
How could you get a result like this:
It would be the same for me if the result came in a json like this:
Thank you!
Upvotes: 0
Views: 60
Reputation:
To get the aggregated JSON you can use jsonb_object_agg()
select users, jsonb_object_agg(day, polls)
from data
group by users;
Upvotes: 1