关于mysql jsonarray 数据解析成新的行列

select id,name,json_unquote(json_extract(json_column,'$[',idx,']','.param1')) as param1,

json_unquote(json_extract(json_column,'$[',idx,']','.param2')) as param2

from test1

join 

(select 0 as idx union

select 1 as idx union

select 2 as idx union

select 3 as idx union

select 4 as idx union

select 5 as idx union

select 6 as idx union

select 7 as idx union

select 8

) as  test2

where json_extract(json_column,concat('$[',idx,']')) is not null ;

 

1.json_unquote:去掉json字符串中的双引号,

2.构造 test2,可以方便json_extract取值,思路很妙,Mark一下

 

上一篇:6-2 提取数字


下一篇:Win32 汇编语言系列教程 [导航菜单]