--Access
select *
from 表B
where ',' + aa + ',' like '*,1,*'
--other
select *
from 表B
where ',' + aa + ',' like '%,1,%'
select *
from 表B
where ',' + aa + ',' like '*,1,*'
--other
select *
from 表B
where ',' + aa + ',' like '%,1,%'
解决方案 »
- 我用C#做程序,我用SelectedRows.Count 统计datagridview选中行行数,但是返回值总是0,无论我选中几行,请各位大虾帮忙解决,不胜感激。
- qq 邮件 空间 sid 怎么获得 使用webcleint ,顶者都有分。谢谢
- 在程序中如何改變文件的屬,我要鎖定文件
- 请大家帮忙,关于 timer 的问题。
- MVC4 WebGrid的问题
- C# httpwebrequest post 下载文件
- 请问如何获取windows进程中某个进程,CPU占用率
- 下面这句话怎么理解,有什么实际用途。。高人们来看看。。
- 兄弟在做pop3的接受程序时!!遇到需要认证的!!如163.com总是在
- SQL语句和存储过程到底有什么区别?我弄不明白
- [求助]C#保存PrintScreen键抓下来的图片
- 为什么会提示“System.Windows.Media.Animation.DoubleAnimation”不包含采用“3”个参数的构造函数
from 表B
where ',' + aa + ',' like '*,1,*'
--other
select *
from 表B
where ',' + aa + ',' like '%,1,%'
select * from 表b where charindex('1,',aa)>0 or charindex(',1,',aa)>0 or charindex(',1',aa)>0 or charindex('2,',aa)>0 or charindex(',2,',aa)>0 or charindex(',2',aa)>0
select * from b
where charindex(','+'1'+',', ','+aa+',')>0
or charindex(','+'2'+',', ','+aa+',')>0
但是,这种语句没效率,索引利用率很低. 应该更改表B存储
表B数据
1 1
1 2
1 3
2 1
2 2
3 3
.......
这样,用数值型存储. 这叫用数据冗余换取效率.
where charindex(','+'1'+',', ','+aa+',')>0
or charindex(','+'2'+',', ','+aa+',')>0////////////////////////////////////
请问要是有数据为 1,2,3 或 1,2
你这样会查出来吗?
查询结构只能与包含数字匹配?
用LIKE与数据多有什么关系。呵呵, LZ需求提得太简单了,表达不够准确。