Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql JSON列任何索引([*])不工作_Mysql_Json - Fatal编程技术网

Mysql JSON列任何索引([*])不工作

Mysql JSON列任何索引([*])不工作,mysql,json,Mysql,Json,我有一个名为prices_和_tags的JSON列,其中JSON数组中有值: [{'price' => 100, 'tag' => 'Watch'}, {'price' => 200, 'tag' => 'Book'}] 如果我想在任何数组索引中搜索tag='Watch'的prices\u标签,它就不起作用了 查询如下: select * from products where prices_and_tags->"$[*].tag" = 'Watch' 这将给出

我有一个名为prices_和_tags的JSON列,其中JSON数组中有值:

[{'price' => 100, 'tag' => 'Watch'}, {'price' => 200, 'tag' => 'Book'}]
如果我想在任何数组索引中搜索tag='Watch'的prices\u标签,它就不起作用了

查询如下:

select * from products where prices_and_tags->"$[*].tag" = 'Watch'
这将给出0个结果

但此查询适用于第一个或第二个数组索引,如下所示:

select * from products where prices_and_tags->"$[0].tag" = 'Watch'
我提到了这个:查询语法

谢谢。

你试过这个吗

select * from products where prices_and_tags->"$.tag[*]" = 'Watch'
参考:你试过这个吗

select * from products where prices_and_tags->"$.tag[*]" = 'Watch'
参考: