不行,我后面还想用 SELECT sum(total) AS A from TJGL 这个语句做求和那
那你可以用 SELECT code, item, times,sum(total) AS A from TJGL group by code, item, times
不行 Invalid column name 'total'.
alert table add total Decimal(10) NULL select code,money*30*times as total into #mytemp from TJGL update TJGL set total=t2.total from TJGL t1 join #mytemp t2 on t1.code=t2.code
1.alter table TJGL add total decimal(10) null go update TJGL set total = money*30*times go select sum(total) from TJGL 2.select sum(money*30*times ) from TJGL
SELECT sum(total) AS A from TJGL
这个语句做求和那
SELECT code, item, times,sum(total) AS A from TJGL group by code, item, times
Invalid column name 'total'.
select code,money*30*times as total into #mytemp from TJGL
update TJGL set total=t2.total
from TJGL t1
join #mytemp t2 on t1.code=t2.code
go
update TJGL set total = money*30*times
go
select sum(total) from TJGL
2.select sum(money*30*times ) from TJGL