--示例代码: declare @tb1 table(a int,b int,i int) insert into @tb1 select 1,2,4 union all select 2,3,4 union all select 3,4,8 union all select 3,4,7select * from @tb1 where a+b<i/* a b i ----------- ----------- ----------- 1 2 4 3 4 8(所影响的行数为 2 行) */
支持 funsuzhou(羡米奇)(努力ing,成为专家中!)
create table tb1(a int,b int) insert into tb1 select 1,2, union all select 2,3, union all select 3,4, union all select 3,4,declare @i int set @i=20 select * from ar where a+b<@I 运行结果 a b 1 2 5 4 6 2
declare @tb1 table(a int,b int,i int)
insert into @tb1
select 1,2,4 union all
select 2,3,4 union all
select 3,4,8 union all
select 3,4,7select * from @tb1 where a+b<i/*
a b i
----------- ----------- -----------
1 2 4
3 4 8(所影响的行数为 2 行)
*/
insert into tb1
select 1,2, union all
select 2,3, union all
select 3,4, union all
select 3,4,declare @i int
set @i=20
select * from ar where a+b<@I
运行结果
a b
1 2
5 4
6 2