mysql连表更新demo
update
member_base_info a
inner join
user_mapping b
on a.member_id=b.o2o_user_id
set a.card_no=b.real_card_no
where a.tenant_id=1055 and (a.card_no is null or a.card_no=”) and b.tenant_id=1055 and b.real_card_no is not null and b.real_card_no<>”;
需要注意的是:set 后面要更改的表不能是子查询,否则会报错”The target table a of the UPDATE is not updatable”