sql update多表关联更新

-- 方法1
update b 
    set b.status= 1 
from t_bed_adapter b, t_adapter a
where a.id = b.adapter_id and a.dept_code = '214'
-- 方法2
update b 
    set b.status = 1 
from t_bed_adapter b
left join t_adapter a on a.id = b.adapter_id 
where a.dept_code = '214'

 

posted @ 2022-03-09 19:08  一隅桥畔  阅读(314)  评论(0)    收藏  举报