您的位置: 首页> 数据库> sql查询一个数组中是否包含某个内容find_in_set问题

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

时间:2023-04-27 11:18:57 来源:互联网

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

如果表Atable中的a字段内容是1,2,3 的格式(a字段是用,分隔的),要查询该字段是否包含1则可以用find_in_set 例:

ida
11,2,3
21111,11
SELECT * FROM Atable WHERE find_in_set(1,a)

结果

ida
11,2,3

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

1.模糊查询like

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

2.charindex()

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

总结

上一篇:SQL IFNULL()函数详细解析(最新推荐) 下一篇:SQL Server下7种“数据分页”方案全网最新最全

相关文章

相关应用

最近更新