update t_table a set (f1,f2,f3)=(select f1,f2,f3 from testz b where a.id=b.id)结果a表中id不在b表中的数据也被更新,f1.f2.f3都变成了空值?
解决方案 »
- 插入1000随机数据
- 如何计算两个日期的时间差(去除非工作时间)
- oracle查询上一个月的第一条记录
- 系统一直重启,怀疑oracle 导致,帮忙分析下日志。谢谢!
- WINDOWS 2003 下ORACLE 的访问权限
- 请问 ORACLE Form Builder 怎么连接 SQL-SERVER 数据库! 急
- 如果imp做full导入的时候用ignore=y参数,会不会对数据字典的表进行insert??造成数据字典的表的数据造成重复
- 查询内存数据库,要比较datetime类型和字符串时间的大小,SQL怎么写
- 安装Oracle for linux时出错?
- oracle在aix上安装时出错?
- 请教一个sql的问题,字段作为查询条件的时候是否自动判断不能为null
- 请教RMAN中的plus archivelog子句。
update t_table a set (f1,f2,f3)=(select f1,f2,f3 from testz b )
where a.id=b.id
...你这个写法明显语法就错误了update t_table a
set (f1, f2, f3) =
(select f1, f2, f3 from testz b where a.id = b.id)
where exists (select 1 from testz b where a.id = b.id)
...你这个写法明显语法就错误了update t_table a
set (f1, f2, f3) =
(select f1, f2, f3 from testz b where a.id = b.id)
where exists (select 1 from testz b where a.id = b.id)
你的回复是正确的,怎么理解这个事情?
...你这个写法明显语法就错误了update t_table a
set (f1, f2, f3) =
(select f1, f2, f3 from testz b where a.id = b.id)
where exists (select 1 from testz b where a.id = b.id)
你的回复是正确的,怎么理解这个事情?没有带where条件,那肯定是全表更新了。
(select f1, f2, f3 from testz b where a.id = b.id)
这个只是代表能不能更新到值,找不到肯定就会置空。
跟表需要更新多少数据是没有直接关系的。
通常关联update、2楼那样是可以的
update t_table a
set (f1, f2, f3) =
(select f1, f2, f3 from testz b where a.id = b.id)
where exists (select 1 from testz b where a.id = b.id)