如下表T,有两个字段A和B。
A B
-----------
1 110010
2 111
3 11111
4 11011111
5 1
6 1111000111SQL语句:
select * from t where b ..........结果:
A B
----------
2 111
3 11111
5 1
A B
-----------
1 110010
2 111
3 11111
4 11011111
5 1
6 1111000111SQL语句:
select * from t where b ..........结果:
A B
----------
2 111
3 11111
5 1
解决方案 »
- 把a表里所有满足条件的记录全部重新插入A表一遍
- SQL EXPRESS 2005怎么实现数据库同步啊
- 关于数据是否修改过的问题!~
- 在线等待-----sql数据库现在打不开该怎么办?
- 这个SQLServer问题再不能解决,我就要被辞职了!摆脱各位高人帮忙看看!100分!
- 过程中的Return 只能返回数值吧?如果返回字符串该啥办?
- 查询中出现了表的数目大于SQL SERVER预定的数目(255),系统报错怎么办?
- 急救啊,大虾们
- 救急!!!救急!!!高手请进!!!
- 老大们,俺用的是sql 7.0 眼瞅着.ldf文件个头越来越大,现在2G多了,怎么办呀?
- SQL数据文件过大
- 创建主键,与创建聚集索引,但是不建主键有何区别呢?
A B
-----------
1 1101235010
2 111
3 11111
4 1111122211
5 1
6 1111000113334546171SQL语句:
select * from t where b ..........结果:
A B
----------
2 111
3 11111
5 1
接个分~
declare @tb table(A int,B int)
insert into @tb select 1,110010
union all select 2,111
union all select 3,11111
union all select 4,1101111
union all select 5,1
union all select 6,111000111
select * from @tb where b not like '%0%'
(6 行受影响)
A B
----------- -----------
2 111
3 11111
5 1(3 行受影响)
declare @table table (A int,B bigint)
insert into @table
select 1,1101235010 union all
select 2,111 union all
select 3,11111 union all
select 4,1111122211 union all
select 5,1 union all
select 6,1111000113334546171select * from @table where len(replace(B,'1',''))=0 /*
A B
----------- --------------------
2 111
3 11111
5 1
*/
insert into @tb
select 1,'110010' union all
select 2,'111' union all
select 3,'11111' union all
select 4,'1101111' union all
select 5,'1' union all
select 6,'1110001' union all
select 7,'00000' select * from @tb where replace(B,left(B,1),'')=''A B
----------- --------------------
2 111
3 11111
5 1
7 00000(4 行受影响)