日期:2014-05-17 浏览次数:20481 次
update A set money=b.money
from A inner join (
select name,SUM(money) money
from(
select name,money
from A
union all
select name,money
from B) as c
group by name) as d on a.name=d.name
insert into A(name,money)
select *
from B where not name in (select name from A)
UPDATE A
SET money = b.money ,
num = b.num
FROM A
INNER JOIN ( SELECT name ,
SUM(money) money ,
SUM(num) num
FROM ( SELECT name ,
money ,
num
FROM A
UNION ALL
SELECT name ,
money ,
&nbs