好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

sql查询一个数组中是否包含某个内容find_in_set问题

sql查询数组中是否包含某个内容find_in_set

如果表At http://www.cppcns.com able中的a字段内容是1,2,3 的 编程客栈 格式(a字段是用,分隔的),要查询该字段是否包含1则可以用fin http://www.cppcns.com d_in_set 例:

id a 1 1,2,3 2 1111,11

SELECT * FROM Atable WHERE find_in_set(1,a)

结果

id a 1 1,2,3

sql判断字段值中是否包含某个字符串

1.模糊查询like

select * from table where field like ‘%key%'

2.charindex()

charindex(字段,字符串)>0 为包含

总结

以上为个人 经验 ,希望能给大家一个参考,也希望大家多多支持我们。www.cppcns.com

查看更多关于sql查询一个数组中是否包含某个内容find_in_set问题的详细内容...

  阅读:46次