1.将B表中不存在于A表中的记录插入A表中:
INSERT INTO A
SELECT FIELD1,FIELD2
FROM B
WHERE NOT EXISTS
(
SELECT * FROM A
WHERE B.ID =A.ID AND OTHERS CONDITION );
2.仅更新A表中满足与B表相关的记录
UPDATE A
SET FIELD1 = FIELD1_VALUE
WHERE EXISTS (
SELECT * FROM A
WHERE B.ID = A.ID AND OTHERS CONDITION ) ;