select ta.id,ta.parent_id,ta.name,ta.level, mr.id as r_id,mr.parent_id as r_pid,mr.name as r_name,mr.type as r_type,mr.provice_id as r_provice_id from test_movhome.area ta, movhome.region mr where ta.name = mr.name # 批量替换,用一个表中的字段 更新 另一个表中的字段 update test_movhome.cinema a inner join (select ta.id,ta.parent_id,ta.name,ta.level, mr.id as r_id,mr.parent_id as r_pid,mr.name as r_name,mr.type as r_type,mr.provice_id as r_provice_id from test_movhome.area ta, movhome.region mr where ta.name = mr.name) b on a.region_id = b.r_id set a.region_id = b.id # 批量替换,用一个表中的字段 更新 另一个表中的字段 update test_movhome.cinema a, (select ta.id,ta.parent_id,ta.name,ta.level, mr.id as r_id,mr.parent_id as r_pid,mr.name as r_name,mr.type as r_type,mr.provice_id as r_provice_id from test_movhome.area ta, movhome.region mr where ta.name = mr.name) b set a.new_region_id = b.id, a.other_filed = b.other_filed where a.region_id = b.r_id # 批量设置一个表中的字段为一个固定的值 update test_movhome.cinema a set a.new_region_id = 0