表a (id,city_id)
id city_id
1 1
2 1,2,3
3 1,11,34,2
4 1,111,34,56
请问 想查询含有11的记录sql语句可以实现吗
我试过
select id,city_id from a where '11'in(city_id)
select id,city_id from a where city_id like '11,%' or city_id like '%,11' or city_id like '%,11,%' 这个可以查询,不知道还有没有更好的方法
id city_id
1 1
2 1,2,3
3 1,11,34,2
4 1,111,34,56
请问 想查询含有11的记录sql语句可以实现吗
我试过
select id,city_id from a where '11'in(city_id)
select id,city_id from a where city_id like '11,%' or city_id like '%,11' or city_id like '%,11,%' 这个可以查询,不知道还有没有更好的方法
解决方案 »
- 求SQL2000下的一条查询语句
- SQL server里设置的自增变量如果要删除中间某些元组怎么办?
- |zyciis| 紧急求助 Group by 日期为 年 周 星期 的问题
- 问一个asp启动SQLServer的问题
- .读取纯真IP库,转换IP为数字,并插入SQL Server数据库,且表中只有(ip,peovince,address)三列
- sql高手速进100分
- 不知道算不算难题,大家来看看,这样的语句怎么写?
- 数据库设计的问题
- sql server 2000中如何添加自动增加数值的ID主键
- 如何不显示一列数据
- 想爆头的sql查询,sql性能优化
- 设置sql代理定时执行计划的alert那里改如何设置
from tb
where chaindex(',11,',','+city_id+',')>0
from tb
where charindex(',11,',','+city_id+',')>0
不好意思,笔误,再试试