1. 程式人生 > >mysql update select

mysql update select

 
將b表查詢結果更新到a表字段

update A inner join(select id,name from B) c on A.id = c.id set A.name = c.name;

更新所有 member_num 

update lop_team t set t.member_num = (select count(tm.uid) from lop_team_member tm where t.team_id=tm.team_id )