光伏路灯有哪几种光源:sql 查询语句

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 19:52:42
表中字段id
数据如下:
id
2,3,4
4,3,2
3,4,5
41
14
怎么查出含有4的数据?
谢谢
不行啊
我试过了
select id from table where charindex('4',id)>0
这样会把14和41都查出来的

mysql数据库:(通过)

select id from table where find_in_set('4',id)>0;

sqlserver数据库:(你试试)

select id from table where charindex(',4,',concat(',',id,',')>0

select * from 表 where id like %'"4"'

select * from 表 where id like '%4%'

扯淡,别听他们的,那种效率很低的,一条两条没什么,大数据量的模糊查询会玩死你的服务器的
应该这样:
select id from table where charindex('4',id)>0
效率绝对比他们的高,不信LZ可以尝试一下
不过我这是SQL Server的
ORACLE我就没搞过了