尝试从json
列获取数据-如这里所述
表格名称-艺术
列名称-顶部
内容示例:
{"what": "video", "title": "antonio"}
在phpmyadmin 5.02
内部查询:
SELECT tops->'$.title' tops FROM arts;
结果-语法错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>'$.title' tops FROM arts LIMIT 0, 25' at line 1
任何帮助
来自phpmyadmin:
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407
分析解答
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>'$.title' tops FROM arts LIMIT 0, 25' at line 1
您的DBMS是MariaDB,而不是MySQL ...
使用JSON_EXTRACT()
代替->
:
SELECT tops, JSON_EXTRACT(tops, '$.title') title FROM arts;