select count(service_code)*(sell_money) as totalmoney
into #table1
from t_tend_info
group by sell_moneyselect @money=sum(totalmoney) from #table1
into #table1
from t_tend_info
group by sell_moneyselect @money=sum(totalmoney) from #table1
into #table1
from t_tend_info
group by sell_moneyselect @money=(select sum(totalmoney) from #table1) --这句改成现在这样就ok