select count(service_code)*(sell_money) as totalmoney
into #table1 
from t_tend_info
group by sell_moneyselect @money=sum(totalmoney) from #table1