mysql update 批量操作

173 阅读1分钟

update info_physid a INNER JOIN (select n.physid from sb_office_eqpt n where n.sgUnitID in (select i.dept_code from info_dept i where (i.parent_code = 'O0405001000' or i.dept_code = 'O0405001000'))) c on a.physid = c.physid set a.physStatus = '01';

简约点就是

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