Reputation: 9293
trying to get data from json
column - as described here
table name - arts
column name - tops
example of content:
{"what": "video", "title": "antonio"}
query inside phpmyadmin 5.02
:
SELECT tops->'$.title' tops FROM arts;
result - syntax error:
#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
any help
from phpmyadmin:
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407
Upvotes: 0
Views: 128
Reputation: 42632
#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
Your DBMS is MariaDB, not MySQL...
Use JSON_EXTRACT()
instead of ->
:
SELECT tops, JSON_EXTRACT(tops, '$.title') title FROM arts;
Upvotes: 1