|
~写不来存储器啊~
不知道这个可不可以,呵呵~
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
select * from table1 |
|