MySQL查询更新所有满足条件的数据

-- 将订单表所有的状态改成1
update oc_repair_preorder a inner join (select id,`status` from oc_repair_preorder) b on a.id = b.id set a.`status` = 1

 

 

 

update oc_repair_order a right join (select id,`status` from oc_repair_order where del=0 and task_id=1 and accept_user_id=666 and `status` in (1,2,3)) b on a.id = b.id set a.`status` = 2

posted @ 2019-06-20 16:32  SoyWang  阅读(1558)  评论(0编辑  收藏  举报