Mysql JSON列中的任何索引([*])都不起作用

时间:2016-10-17 07:40:05

标签: mysql json

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

[{'price' => 100, 'tag' => 'Watch'}, {'price' => 200, 'tag' => 'Book'}]

如果我想搜索price_tags,其中tag =' Watch'在任何数组索引中,它都无法正常工作。

查询是这样的:

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

这给出了0个结果。

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

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

我提到了这个:https://dev.mysql.com/doc/refman/5.7/en/json-path-syntax.html用于查询语法。

感谢。

1 个答案:

答案 0 :(得分:0)

你试过这个吗?

browserHistory.push("/some/path?param1=value1");

参考:https://dev.mysql.com/doc/refman/5.7/en/json.html