Sql 使现代化在哪里…内部连接
我一直在尝试通过内部连接来更新我的记录。。。但是还没有找到关于它的任何文档 这是我目前的疑问Sql 使现代化在哪里…内部连接,sql,oracle11g,sql-update,Sql,Oracle11g,Sql Update,我一直在尝试通过内部连接来更新我的记录。。。但是还没有找到关于它的任何文档 这是我目前的疑问 update TBL1 set carga = '2016-11' where ( select h.CASEID from TBL1 h inner join TBL2 t on h.caseid = t.caseid) 我想你想要存在: update TBL1 set carga = '2016-11' where exists (select 1
update TBL1 set carga = '2016-11' where (
select h.CASEID
from TBL1
h inner join TBL2 t
on h.caseid = t.caseid)
我想你想要
存在
:
update TBL1
set carga = '2016-11'
where exists (select 1
from TBL2 t
where TBL1.caseid = t.caseid
);
您也可以在中使用:
update TBL1
set carga = '2016-11'
where caseid in (select t.caseid from TBL2 t);
似乎您需要合并:
merge into TBL1 t1
using ( select * from TBL2) t2
on ( t1.caseid = t2.caseid)
when matched then
update set carga = '2016-11'
我认为您的where子句中缺少了“TBL1.CASEID=”:
update TBL1 set carga = '2016-11' where TBL1.CASEID = (
select h.CASEID
from TBL1
h inner join TBL2 t
on h.caseid = t.caseid)
您可能错过了这里的TBL1.CASEID IN=(…第一个方法更改了我在TBL1上的所有行,现在尝试第二个方法第二个方法给了我正确的答案。谢谢!