to hh7yx:你这种写法也有问题,没有加where 条件,会将A表中不符合条件的记录的相应字段改为空 update test_tmp A set (a2, a4 ) = ( select b2, b4 from test_tmp1 B where b1=A.a1 and b3=A.a3 ) where exists ( select 'X' from test_tmp1 B where b1=A.a1 and b3=A.a3 ) 这样写就正确了
UPDATE B SET (B1,B2)=(SELECT A1,A2 FROM A WHERE B.B3=A.A3 AND B.B4=A.A4)
17,140
社区成员
55,259
社区内容
加载中
试试用AI创作助手写篇文章吧