update test a set idname=
(select b.idname from test b b where b.id=a.id)
where exists(select 1 from test b b where b.id=a.id) ;
注意:
(where exists(select 1 from testb b where b.id=a.id):如果没有这个条件,不匹配的选项也会被更新。
update test a set idname=
(select b.idname from test b b where b.id=a.id)
where exists(select 1 from test b b where b.id=a.id) ;
注意:
(where exists(select 1 from testb b where b.id=a.id):如果没有这个条件,不匹配的选项也会被更新。