## sighup (rts@xxxxxxxxx): > How can I extract the value of the 'items' key either as two rows and or > a sum of both. select id, jsonb_array_elements(markers)->>'items' from data; And as jsonb_array_elements() returns a setof jsonb: with tab(id, items) as ( select id, (jsonb_array_elements(markers)->>'items')::integer from d ) select id, sum(items) from tab group by id; Regards, Christoph -- Spare Space -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general