Insert Into Table1 (a1,a2,a3,amount1,time)
select b1,b2,b3,sum(amount2) as amount1,getdate() as time from table2 group by b1,b2,b3
如果你要不数据累加到TABLE1中则:
Update Table1 Set table1.Amount1=table1.Amount1+b.amount2,table1.time=getdate()
from (select b1,b2,b3,sum(amount2) as amount2 from table2 group by b1,b2,b3) b
where table1.a1=b.b1 ans table1.a2=b.b2 and table1.a3=b.b3