mysql更新一个表里的字段等于另一个表某字段的值

修改一张表中的一个字段值为另一张表中的一个字段值,根据条件

update a left join c on a.id = c.id set a.body = c.c1 where a.id=c.id;

update zcat as z left join zcat_bak_1212 as zb on z.zcatId = zb.zcatId set z.zcatName = zb.zcatName where z.zcatName is null;


或者

update wx_phone_number_copy c,wx_phone_number r set c.orders = r.orders
where c.phonenumber = r.phonenumber and c.phonenumber = '13696539767';

你可能感兴趣的:(mysql)