2个回答
展开全部
select a.value-b.value from (select row_number() over (order by 字段) xh,value from t1) a,
(select row_number() over (order by 字段) xh,value from t2) b where a.xh=b.xh-1
(select row_number() over (order by 字段) xh,value from t2) b where a.xh=b.xh-1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
create table biao22 ( a int)
insert biao22 select '10'
insert biao22 select '9'
insert biao22 select '20'
insert biao22 select '25'
insert biao22 select '18'
insert biao22 select '7'
select * from biao22
create table #A ( id int identity(1,1), a int)
insert into #a(a)
select * from biao22
declare @a int
declare @b int
select @a=min(id) from #a
select @b=max(id) from #a
while (@a<@b)
begin
select t1.a-t2.a from #a t1,#a t2 where t1.id=t2.id+1 and t1.id=@a
set @a=@a+1
end
insert biao22 select '10'
insert biao22 select '9'
insert biao22 select '20'
insert biao22 select '25'
insert biao22 select '18'
insert biao22 select '7'
select * from biao22
create table #A ( id int identity(1,1), a int)
insert into #a(a)
select * from biao22
declare @a int
declare @b int
select @a=min(id) from #a
select @b=max(id) from #a
while (@a<@b)
begin
select t1.a-t2.a from #a t1,#a t2 where t1.id=t2.id+1 and t1.id=@a
set @a=@a+1
end
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询