【发布时间】:2018-07-08 05:05:06
【问题描述】:
我在mysql表statistics中有关注JSON format,列是stats
{
"stats":{
"gender":{
"male":40, //40 is percentage
"female":50
},
"cities":[
{
"name":"Melbourne",
"country":"AU",
"percentage":20
},
{
"name":"London",
"country":"GB",
"percentage":10
},
{
"name":"Sydney",
"country":"AU",
"percentage":14
}
]
}
}
我知道的(使用 -> 或 JSON_EXTRACT):
select * from statistics as a where a.stats->'$.stats.gender.male' < 41
It returns the above row since male percentage is 40.
要求:
我需要获取国家 AU和百分比 20的记录。
任何建议将不胜感激。
【问题讨论】:
标签: mysql sql json mysql-json