SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table test(id int, some_column jsonb); insert into test(id, some_column) values (1, '[{"name": "1_1"}, {"name": "1_2"}]'), (2, '[{"name": "2_1"}, {"name": "2_2"}]'); select id, json_agg(d->'name') from test cross JOIN LATERAL jsonb_array_elements(some_column) as d group by test.id;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear