I have options
JSONB field:
And I can get JSONB array:
SELECT "options" FROM "products";
->
'[["black", "2"], ["white", "7"]]'::JSONB
But, How can I make array of arrays?
->
ARRAY[ARRAY['black', '2'], ARRAY['white', '7']]
CodePudding user response:
select (
select array_agg(
(select array_agg(s) from jsonb_array_elements_text(a) j2(s))
) from jsonb_array_elements(options) j1(a)
) from products