update B set Amount_2=a.Amount from B inner join A on B.ID=A.IDinsert into B(ID,Amount_2) select a.ID,Amount from A left join B on a.ID=b.ID where b.ID IS NULL
insert into A select B.id,B.Amount_2 from B not exists (select * from A where A.id=B.id) ---------- update A set Amount2=Amount from B inner join A on A.id= B.id
SELECT a.ID,0
FROM A LEFT JOIN B ON a.ID=b.ID
WHERE b.ID IS NULLUPDATE B
SET Amount_2=a.Amount
FROM B ,A
WHERE B.ID=A.ID
UPDATE B
SET B.Amount2=A.Amout
FROM A,B
WHERE A.ID=B.IDINSERT INTO B(ID,Amount2)
SELECT A.ID,A.Amount
FROM A
WHERE A.ID NOT IN (SELECT B.ID FROM B)
SET B.Amount2=A.Amout
FROM A,B
WHERE A.ID=B.IDINSERT INTO B
SELECT *
FROM A
WHERE NOT EXISTS(SELECT 1 FROM B WHERE A.ID = ID)
拼写错误,应该是Amount,少了一个n.
set Amount_2=a.Amount
from
B
inner join
A
on
B.ID=A.IDinsert into B(ID,Amount_2)
select a.ID,Amount
from A
left join B
on a.ID=b.ID
where b.ID IS NULL
insert into A
select B.id,B.Amount_2 from B not exists
(select * from A where A.id=B.id)
----------
update A set Amount2=Amount from B inner join A on A.id= B.id