我根据where条件从mysql的json字段中搜索数据。但没有数据显示。
"attributes_list“的json类型的MySql字段名
我的json数据:
{
"0":
{
"id": "01c93aae-8603-42f3-b097-89357467872a#####ed20eb29-611a-4e5c-a966-c09708c98179",
"text": "Canada",
"attr_name": "Country"
},
"1":
{
"id": "01c93aae-8603-42f3-b097-89357467872a#####6e6269a1-afbb-4d5d-b2ee-6d25fe38fec7",
"text": "Ontario",
"attr_name": "REGION"
},
"2":
{
"id": "5a0a085e-f3e4-4fbe-9f3e-61cec4836d36#####d81923c9-9532-4375-ba3d-19214ac61c4e",
"text": "Lager",
"attr_name": "TYPE"
},
"-1": {"id": "", "text": "", "attr_name": ""}
}我的mysql的json查询:
当我运行以下查询时,则显示数据
SELECT * FROM products where attributes_list->'$[0]."0".text' = 'Canada';但当我运行此命令时,没有显示数据
SELECT * FROM products where attributes_list->'$[0]."*".text' = 'Canada'; 我解释一下我的情况:
在product表中有6行。在product表中,有一个字段,其名称是属性列表。
此字段为json类型。产品具有多个保存属性。我的attribute_list json格式是
{"0":{"id":"","text":""},"1":{"id":"","text":""}}. 现在我想搜索where text='Canada‘,然后阅读这些产品信息
https://stackoverflow.com/questions/41457939
复制相似问题