select吧 关注:45贴子:290
  • 0回复贴,共1

我想把第二条和后面的ce的值为第一条ce的值减去num。这个怎样实现。

只看楼主收藏回复

declare @sum int, @ce int set @sum=15
select id,num,@sum, sum(@sum -num) as ce
from tbl as a  
group by id,num order by id asc


IP属地:广西1楼2011-01-17 11:56回复