易截截图软件、单文件、免安装、纯绿色、仅160KB

求SQL一条语句的解决方法

比如 我有一个表 bumen

里面 有一个列  quanxian
id  name  quanxian

1    a    001;002;003;
2    b    002;003;
3    c    003;004;
4    d    001;002;003;

我的意思是把quanxian列中含有002的数据取出来;显示在gridview上?
请大侠们帮忙! 
select * from tumen where quanxian like '%002%'

select * from tumen where quanxian like '%002%'
select * from tumen where charindex('002',quanxian) > 0

SQL code:

if object_id('ta') is not null drop table ta
go
create table ta(id int, name varchar(1), quanxian varchar(20))
insert into ta select
1, 'a', '001;002;003;' union all select
2, 'b', '002;003;' union all select
3, 'c', '003;004;' union all select
4, 'd', '001;002;003;'

select * from ta
where charindex(';002;',';'+quanxian)>0

id name quanxian
----------- ---- --------------------
1 a 001;002;003;
2 b 002;003;
4 d 001;002;003;

(3 行受影响)



SQL code:
select * from tumen where charindex(','+'002'+',',','+quanxian+',') >


相关问答:

求教一个Sql查询问题。

有三个表一个是采购单格式如下
入库单表:

入库单号      产品        质检编号      入库数量
001          品种1&n ......

求问一SQL语句


客户表:
客户编号    客户销售总额
aa            200
bb            300
cc            ......

求 拼VB SQL insert into 字符串

  INSERT INTO StudAchieve(studID,studName)
  VALUES('2','abc'),('2','bcd'),('2','cde')

  拼了半天也不对,及啊 。。。。
SQL c ......

sql 查询-更新 阻塞。。。。?

遇到的现象是 同一个表的query会阻塞update

sql  query 和update 操作 query会阻塞update操作吗

怎么解决

是不是什么设置不对还是怎的


如果会的话,那同一个表的频繁query and ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号