I have a query I need to run that accesses a doubly nested array inside a json blob. The data is structure like the following:
{
"id" : "5",
"data" : "[[1,2,3],[2,3,4],[4,5,6]....]
}
My query needs to take the max of the second value (e.g. 5 in the case given). The following query returns almost what I need:
SELECT
id,
(
SELECT
string_agg(value :: text, ',') AS list
FROM
jsonb_array_elements_text(data -> 'MMC')
) as MMCPow
FROM
comp
gives me:
[1,2,3],[2,3,4],[4,5,6]....
Can anyone get me the rest of the way?