1、关联删除:
目的:删除掉A表中能关联B表的数据
delete from A as a
using B as b
where a.zd1=b.zd1
2、关联修改,关联新增
目的:当A表中数据能关联B表时,修改A表中数据为B表数据,当关联不到时,在A表1中新增B表数据
MERGE INTO A as a
USING B as b
ON a.zd1=b.zd1
WHEN MATCHED THEN --当关联上时,修改
UPDATE SET a.zd2
1、关联删除:
目的:删除掉A表中能关联B表的数据
delete from A as a
using B as b
where a.zd1=b.zd1
2、关联修改,关联新增
目的:当A表中数据能关联B表时,修改A表中数据为B表数据,当关联不到时,在A表1中新增B表数据
MERGE INTO A as a
USING B as b
ON a.zd1=b.zd1
WHEN MATCHED THEN --当关联上时,修改
UPDATE SET a.zd2