Mysql JsonArray in 查询
mysql存储JsonArray字符串,使用in查询指定属性信息。
JsonArray文本:[ { "answerContent":"张三", "topicContentId":501778, "topicId":1502 }, { "answerContent":"23",] "topicContentId":501779, "topicId":1503 }, { "topicContentId":501780, "topicId":1504 } ]
查询sql:
SELECT content FROM answer_content WHERE questionnaire_id = 14 AND JSON_CONTAINS( content ->> '$[*].topicId',JSON_ARRAY(1502,1503),'$')