Accessing nested array in json blob in PostgreSQL
Your example data and your example query do not fit together.  There is no JSONB field named 'MMC' in the data, but there is in the query, for example.

Assuming the query is the thing that is correct, then something like this would work:

SELECT
  id,
  (
    SELECT
      max((value-&gt;1) :: int) AS _max_
    FROM
      jsonb_array_elements(data -&gt; 'MMC')
  ) as MMCPow
FROM
  comp


Don't use "jsonb_array_elements_text" or ":: text" when you don't want them converted to text, use the -&gt; operator to index into a JSONB array to get the 2nd element (JSONB arrays start counting from 0), and use "max" to take the max.