I want to transform a json column called words inside a database table called data_table into a table. The content of the column is:
{"123456":{"first":"hello","second":"there"},
"78910":{"first":"All good?"}
}
I want to reach sth like this output:
ID | word |
-------+----------|
123456 |hello |
-------+----------|
78910 |All good? |
I tried this:
SELECT * FROM data_table t1,
JSON_TABLE( t1.words, '$.123456.*' COLUMNS (word PATH '$.first')) AS jt;
But it returns a #1064 mysql syntax error. Where is the error???
COMPLETE ERROR CODE (translated from german):
Error in the SQL-Syntax. Please consult the manual for the correct syntax near '( t1.words, '$.123456.*' COLUMNS (word PATH '$.first')) AS jt LIMIT 0, 25' in line 2
I moreover noticed that the basic example of this page:
SELECT *
FROM
JSON_TABLE(
'[ {"c1": null} ]',
'$[*]' COLUMNS( c1 INT PATH '$.c1' ERROR ON ERROR )
) as jt;
Also returns a #1064 syntax error (translated from german):
#1064 - There's an error in your SQL-Syntax. Please consult the manual for the correct syntax near '(
'[ {"c1": null} ]',
'$[*]' COLUMNS( c1 INT PATH '$.c1' ERROR ON E...' on line 3
What's wrong??? Btw, my host says that my mysql version is 10.3-MariaDB..
UPDATE
No matter what I try here, I always get a #1064 mysql syntax error, telling me to correct my syntax near {whatever comes after JSON_TABLE( in my statement}. What is wrong??
According to this, is JSON_TABLE actually not even available for me??