如t_project表的survey字段内容如下:
{"id":"GSD3PP","title":"多选题2","description":"感谢您能抽出几分钟时间来参加本次答题,现在我们就马上开始吧!","type":"Survey","attribute":{"suffix":"您已完成本次问卷,感谢您的帮助与支持","submitButton":"提交","globalRule":[]},"children":[{"id":"f9hh","title":"多选题","type":"Checkbox","attribute":{"required":true},"children":[{"id":"xaio","title":"选项1","attribute":{}},{"id":"oz3w","title":"选项2","attribute":{}}]}]}
想要单独查询description的内容,那么可以使用substring_index()方法,格式为:
substring_index(substring(字段名, '开头字符', -1), '结尾字符', 1)
结合上面的表,实际查询语句为:
select substring_index(substring_index(survey, 'description\":\"', -1), '\",\"type', 1) as description from t_project