MySQL 5.7 JSON: how to set variable to json_contains_path like ‘$.name’

You just need to add a CONCAT() function such as

SELECT name, JSON_CONTAINS_PATH(json, 'one',CONCAT('$."',name,'"')) AS jsonExists
  FROM json_test1 

Demo

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top