iam using mysql 5.7.17 (latest version)
iam使用mysql 5.7.17(最新版本)
this is my table samp1
这是我的表samp1
mysql> select *from samp1;
+-----+----------------------------------------------------------------+
| id | jdoc |
+-----+----------------------------------------------------------------+
| 101 | {"k1": 12, "k2": 34} |
| 111 | {"k1": 12, "k2": 34, "k3": {"L1": "value1", "L2": "value2"}} |
| 112 | {"k1": 12, "k2": 34, "k3": {"L1": "value1", "L2": "value2"}} |
| 125 | {"7": "123", "8": 10, "9": "hey", "10": ["dar", "sne", "swo"]} |
+-----+----------------------------------------------------------------+
when i use below query it's executing properly
当我使用下面的查询它正在执行
select id,jdoc -> "$.k3" as f from samp1 ;
but when i use this query with single number key. it throwing error,why?
但是当我使用单个数字键的查询时。它抛出错误,为什么?
select id,jdoc -> "$.7" as f from samp1 ;
ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 3.
1 个解决方案
#1
8
This should work:
这应该工作:
select id,jdoc -> '$."7"' as f from samp1
#1
8
This should work:
这应该工作:
select id,jdoc -> '$."7"' as f from samp1