入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

Mysql里查询字段为Json格式的数据模糊查询方法

创建时间:2016-09-27 投稿人: 浏览次数:10799
json表里面有个content字段数据如下面的Json格式

{"eq":{"f_1360040399":"admin","f_3038116851":"20","f_318208994":"admin@localhost.com"}}

需要对其中的f开头的Json key值所对的value进行模糊查询,方法如下:

select * from table where content->"$.eq.f_1360040399" like "%min%"


也可以用如下的方法,不过推荐使用上面的方法:

select content, left(substring(content, locate(""f_1360040399":"", content)), locate(",", substring(content, locate(""f_1360040399":"", content)))) as a from table where a like "%mi%"

其它情况可以参考:http://www.cnblogs.com/waterystone/p/5626098.html

声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。