表C 表D
id code specification id code specification
1 001 AAA 1 002 ABC
2 002 BBB
3 003 CCC
要求將表C修改為
id code specification id code specification
1 001 AAA 1 002 ABC
2 002 ABC
3 003 CCC
select * from C where C.code in (select D.code from D)
UPDATE C SET specification= D.specification FROM C, D
WHERE D.CODE = C.CODE