例如:计算某一类的和,则用select sum(a) from table
那么我想计算这一列的积呢,或者说把这一列的数值进行与运算,分别都该如何做呢
------解决方案--------------------
declare @a int
select @[email protected]*a from table
------解决方案--------------------
楼上正解....
------解决方案--------------------
declare @t table(a int)
declare @b int
set @b=1
while(@b <=5)
begin
insert into @t select @b
set @[email protected]+1
end
select * from @t;
declare @a int;
set @a=1
select @[email protected]*a from @t;
print @a
------解决方案--------------------
是要先赋值,一楼给漏了.