首頁 >資料庫 >mysql教程 >mysql5.7如何获取json数组里的某些值

mysql5.7如何获取json数组里的某些值

WBOY
WBOY原創
2016-06-06 09:33:384728瀏覽

mysql

json数组是这样的:
[
{"name":"a","score":20,"wrongID":[1,2,6,7]},
{"name":"b","score":50,"wrongID":[1,2,3,7]},
{"name":"c","score":40,"wrongID":[1,2,9,17]},
{"name":"d","score":70,"wrongID":[1,2,16,27]},
{"name":"e","score":80,"wrongID":[1,2,10,17]},
{"name":"f","score":50,"wrongID":[1,2,10,17,22,33]},
]

表名student,列名是examInfo
比如,我要获取数组里score为50的wrongID,要怎么获取呢??
我之前写了一条sql:
select examInfo->'$[*].wrongID' from student where examInfo->'$[*].score'=50;
结果查不出来,没数据也没报错,50变成了'50',结果也是一样,没数据。
有大牛知道怎么查吗?请教!!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn