Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 使现代化在哪里…内部连接_Sql_Oracle11g_Sql Update - Fatal编程技术网

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上的所有行,现在尝试第二个方法第二个方法给了我正确的答案。谢谢!