22,294
社区成员
发帖
与我相关
我的任务
分享--现在的@zz=8 @yy=4
set @z=1
WHILE @z<@zz
BEGIN
set @y=1
WHILE @y<@yy
begin
declare @strx varchar(10)
if @y=1
begin
set @strx='上层'
end
else if @y=2
begin
set @strx='中上层'
end
else if @y=3
begin
set @strx='中下层'
end
else if @y=4
begin
set @strx='下层'
end
insert #result
select @z,@y,Temperature,'0','0','0','0','0','0','0','0','0','0','0','0','0' from #temp where Row='01'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0',Temperature,'0','0','0','0','0','0','0','0','0','0','0','0' from #temp where Row='02'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0',Temperature,'0','0','0','0','0','0','0','0','0','0','0' from #temp where Row='03'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0',Temperature,'0','0','0','0','0','0','0','0','0','0' from #temp where Row='04'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0',Temperature,'0','0','0','0','0','0','0','0','0' from #temp where Row='05'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0',Temperature,'0','0','0','0','0','0','0','0' from #temp where Row='06'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0',Temperature,'0','0','0','0','0','0','0' from #temp where Row='07'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0','0',Temperature,'0','0','0','0','0','0' from #temp where Row='08'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0','0','0',Temperature,'0','0','0','0','0' from #temp where Row='09'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0','0','0','0',Temperature,'0','0','0','0' from #temp where Row='10'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0','0','0','0','0',Temperature,'0','0','0' from #temp where Row='11'and PLevel=@y and Point=@z
insert #result
select @z,@y,'0','0','0','0','0','0','0','0','0','0','0',Temperature,'0','0' from #temp where Row='12'and PLevel=@y and Point=@z
select @avgtmpt=convert(varchar,round(avg(convert(float,Temperature)),2),20) from #temp where PLevel=@y and Point=@z
select @maxtmpt=convert(varchar,max(convert(float,Temperature)),20) from #temp where PLevel=@y and Point=@z
insert #result2
select Surface,PLevel,sum(round(convert(float,a),2)) as a,sum(round(convert(float,b),2)) as b,sum(round(convert(float,c),2)) as c,sum(round(convert(float,d),2)) as d,sum(round(convert(float,e),2)) as e,sum(round(convert(float,f),2)) as f,sum(round(convert(float,g),2)) as g,sum(round(convert(float,h),2)) as h,sum(round(convert(float,i),2)) as i,sum(round(convert(float,j),2)) as j,sum(round(convert(float,k),2)) as k,sum(round(convert(float,l),2)) as l,@avgtmpt,@maxtmpt from #result
group by Surface,PLevel
delete #result
set @y=@y+1
END
set @z=@z+1
END
[Quote=引用 25 楼 x2593304 的回复:]