--定义你的变量 declare @var numeric select @var=0.01 while @var<=1 --循环你的变量 --执行你的语句 select min(price)as aa,id as bb into #tmp from test where price>0.58 (变量)group by id Select sum(volume) From test From test join #tmp on id = bb and price = aa Drop Table #tmp select @var=@var+0.01 wend
--定义你的变量 declare @var numeric select @var=0.01 while @var<=1 --循环你的变量 --执行你的语句 select min(price)as aa,id as bb into #tmp from test where price>@var (变量)group by id Select sum(volume) From test From test join #tmp on id = bb and price = aa Drop Table #tmp --这里应该有一个把你的比较结果存入临时表的动作 select @var=@var+0.01 wend --这里应该有一个查询结果临时表的动作
select * into #lfy from test create table #lfy2( aa numeric,id int) go --定义你的变量 declare @var numeric select @var=0.0 while @var<=1 --循环你的变量 --执行你的语句 insert into #lfy2 select sum(price) as aa,id as bb from #lfy where id>=@var group by id --这里应该有一个把你的比较结果存入临时表的动作 select @var=@var+0.01 wend --这里应该有一个查询结果临时表的动作 select * from #lfy2 order by id
declare @var numeric
select @var=0.01
while @var<=1 --循环你的变量
--执行你的语句
select min(price)as aa,id as bb into #tmp from test where price>0.58 (变量)group by id
Select sum(volume) From test From test join #tmp on id = bb and price = aa
Drop Table #tmp
select @var=@var+0.01
wend
declare @var numeric
select @var=0.01
while @var<=1 --循环你的变量
--执行你的语句
select min(price)as aa,id as bb into #tmp from test where price>@var (变量)group by id
Select sum(volume) From test From test join #tmp on id = bb and price = aa
Drop Table #tmp
--这里应该有一个把你的比较结果存入临时表的动作
select @var=@var+0.01
wend
--这里应该有一个查询结果临时表的动作
create table #lfy2( aa numeric,id int)
go
--定义你的变量
declare @var numeric
select @var=0.0
while @var<=1 --循环你的变量
--执行你的语句
insert into #lfy2
select sum(price) as aa,id as bb from #lfy where id>=@var group by id
--这里应该有一个把你的比较结果存入临时表的动作
select @var=@var+0.01
wend
--这里应该有一个查询结果临时表的动作
select * from #lfy2 order by id