# 修改用户基本资料
update ii. a a
set a.rr= ( select distinct b.rr from b b
where a.ff = b.ff and b.rr is not null and length(a.ff) > 12 )
where exists ( select 'x' from gg.b b
where a.ff= b.ff and b.rr is not null and length(a.ff) > 12 ) ;
改成:
merge into ii.a
using ( select ff,rr from gg.b where length(b.ff)> 12 )
on ( a.ff = b.ff )
when matched then
update set a.rr = b.rr
后者更高效!