请教是不是要写一个存储器?作者: 软件测试论坛 时间: 2008-3-21 17:00
~写不来存储器啊~
不知道这个可不可以,呵呵~
if exists (select * from sysobjects where name = 'table1')
drop table table1
create table table1 (date int , fare int)
insert into table1 values(1 , 60)
insert into table1 values(2 , 34)
declare @a int
declare @b int
declare @x int
declare @y int
set @a = 1
set @b = 2
while (@b<=29)
begin
set @x = (select fare from table1 where date = @a)
set @y = (select fare from table1 where date = @b)
insert into table1 values(@a+2 , @x+@y)
set @a = @a + 1
set @b = @b + 1
end