Hi can anyone tell me what is wrong with this query.
DECLARE @json LONGTEXT;
SET @json = \'[ { \"name\":\"John Smith\", \"address\":\"780 Mission St, San
First, in mysql you don't need to declare a variable, in this case. Just use 'SET' keyword. And finaly, you need put an alias for your 'select' query. Like this:
SET @json = '[ { "name":"John Smith", "address":"780 Mission St, San Francisco, CA 94103"}, { "name":"Sally Brown", "address":"75 37th Ave S, St Cloud, MN 94103"}, { "name":"John Johnson", "address":"1262 Roosevelt Trail, Raymond, ME 04071"} ]';
##SELECT @json;
SELECT * FROM JSON_TABLE (@json, '$[*]' COLUMNS (
`name` VARCHAR(40) PATH '$.name',
`address` VARCHAR(100) PATH '$.address')) AS T;