## sighup (rts(at)sighup(dot)eu):
> 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