If I have a query like
SELECT a.id, a.name, json_agg(b.*) as "item"
FROM a
JOIN b ON b.item_id = a.id
GROUP BY a.id, a.name;
How can I select the columns in b
so I don't have b.item_id
in the JSON object?
Edit
I'm reading about ROW, but it returns a JSON object like {"f1": "Foo", "f2": "Bar"}
.
{"f1": "Foo", "f2": "Bar"}
? Isn't that what you've been after? – Erwin Brandstetter Jul 3 at 15:10