这是真实的方式
create function getSumBSen2(@pfpre INT, @pdpre INT, @pSen INT) returns intasbegin declare @r int; select @r= sum(t2.t_shab + t2.t_rooz) from tbl1 t2 where t2.FCode = @pfpre and t2.DCode = @pdpre and t2.sen <= @pSen; return (@r);end;GOselect t1.sen, sum(t1.d1) as d1, sum(t1.d2) as d2, sum(t1.d1 + t1.d2) as d_sum, Round((sum((1000*(t1.d1+t1.d2)+0.01)/(9500-(dbo.getSumBSen2(t1.FCode, t1.DCode, t1.sen))))),1) as SSS from tbl1 t1where t1.FCode = 81 and t1.DCode = 1 group by t1.sen;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)