日期:2014-05-17 浏览次数:20471 次
ert into table1 (id,summoney) select id ,sum(money) from table2 group by id
------解决方案--------------------
insert into table1(id,summoney)
select id,sum(money)
from table2
group by id
------解决方案--------------------
怎么个相加办法 看的不是很懂啊
猜一个
insert into table1 select id,sum(money) from table2 where kind in('a','b') group by id
------解决方案--------------------
insert into table1 (id,summoney) select id ,sum(money) from table2 group by id
------解决方案--------------------
如果你的table1有数据,那要用update,如果没数据,就用insert
我给个insert 的例子
insert into table1
select a.id,b.money+b.kind
from table1 a inner join table2 b on a.id=b.id
------解决方案--------------------