[英]How To extract Value from Json multi dimension Array In MySQL
列包含下面給出的值。
[
{
"bActive": false,
"sSubLocation": "",
"aiSeries": [],
"iUser": "1"
},
{
"bActive": true,
"sSubLocation": "Mytestcase",
"aiSeries": [],
"iUser": "1"
}
]
我想將結果作為 sSubLocation 鍵獲得 bActive =true 和 sSubLocation = "Mytestcase";
SELECT test.id, jsontable.*
FROM test
CROSS JOIN JSON_TABLE(test.value,
'$[*]' COLUMNS (bActive BOOLEAN PATH '$.bActive',
sSubLocation VARCHAR(255) PATH '$.sSubLocation',
aiSeries JSON PATH '$.aiSeries',
iUser VARCHAR(255) PATH '$.iUser')) jsontable
HAVING bActive = true
AND sSubLocation = 'Mytestcase'
https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=bcf7f238e23a2c282cdea76c183ae8fa
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.