SQL批量更新的问题(两张表更新)

来源:百度知道 编辑:UC知道 时间:2024/06/17 02:59:28
我要更新一张表A的记录,当他的ID在B表中时,将他里面的状态status全部更新为1
我这样写怎么的不行
update A set a.status='1' where id in (select b.id from B b)
我要怎样的写才可以
谢谢了
我的是ORACLE数据库,涉及到数据批量更新

update A set A.status='1' where id in (select id from B)

update A set status='1' where id in (select id from B)

批量是什么概念?
怎么批量?

Update A
Set a.status='1'
Where a.id in (select b.id from B b)

是什麼数据库?

oracle/MS SQL 以上都可以

我这样写怎么的不行 ?

出错信息贴出来

update A set status='1'
from A a WHERE id in (select id form B b where b.id=a.id )

update A set status='1' where id in (select id from B)
oracle下我已经测试了,OK