华佗小知识
您的当前位置:首页find_in_set(str,strList)和like区别

find_in_set(str,strList)和like区别

来源:华佗小知识

str是要查询的值   strList是目标值格式用逗号隔开(1,2,3)

 数据表

like是模糊查询 例如:

select * from user_role where user_ids like "%2%"

结果:(只要是user_ids字段的值有2就符合)

 

find_in_set()是精确查询 例如:

select * from user_role where find_in_set(2,user_ids)

结果:(user_ids先根据逗号分割,分割后的结果中有2的符合)

 

因篇幅问题不能全部显示,请点此查看更多更全内容