task_id json_data
task1 [ [160, "4d3a339c-68ba"], [15, "554fc01c-b5d2"] ]
我必须将上面的图像更改为以下格式:
task_id area iiid
task1 160 "4d3a339c-68ba"
task1 15 "554fc01c-b5d2"
您可以将json内容转换为数组数组,然后取消测试,然后将每个子数组的第一个和第二个元素:
select t.task_id, x.ar[0] area, x.ar[1] iiid
from mytable t
cross join unnest(cast(t.json_data as array(array(varchar)))) as x(ar)