1、两表(多表)关联update -- 被修改值由另一个表运算而来

  update customers a

  set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)

  where exists (select 1

  from tmp_cust_city b

  where b.customer_id=a.customer_id)

  实例: 

  update bd_psndoc
  set bd_psndoc.indutydate=(select begindate from (select a.pk_psnbasdoc as pk_psnbasdoc,
  max(b.begindate) as begindate
  from temp_psnbasdoc a left join hi_psndoc_deptchg b
  on a.pk_psnbasdoc=b.pk_psnbasdoc and a.recordnum=b.recordnum
  group by a.pk_psnbasdoc) tt where tt.pk_psnbasdoc=bd_psndoc.pk_psnbasdoc)
  where exists(select 1 from (select a.pk_psnbasdoc as pk_psnbasdoc,
  max(b.begindate) as begindate
  from temp_psnbasdoc a left join hi_psndoc_deptchg b
  on a.pk_psnbasdoc=b.pk_psnbasdoc and a.recordnum=b.recordnum
  group by a.pk_psnbasdoc) tt where tt.pk_psnbasdoc=bd_psndoc.pk_psnbasdoc)
  and pk_psncl='00015T100000000003M2' and indutydate is null

oracle中Update方法的更多相关文章

  1. Unity3d中Update()方法的替身

    在网上看到一些资料说Unity3d的Update方法是如何如何不好,影响性能.作为一个菜鸟,之前我还觉得挺好用的,完全没用什么影响性能的问题存在.现在发现确实有很大的问题,我习惯把一大堆检测判断放在U ...

  2. oracle中merge方法

    先看SQL语句:merge into employee e using emps em on (e.emp_id=em.emp_id) when matched then  update set e. ...

  3. oracle中REGEXP_SUBSTR方法的使用

    近期在做商旅机票平台,遇到这样一个问题: 有一张tt_ticket表,用来存机票信息.里边有一个字段叫schedule,表示的是行程,存储格式为:北京/虹桥 由于公司位于上海.而上海眼下有两个机场:浦 ...

  4. oracle 中update多个字段

    update  A set (A.a2,A.a3) =(select B.b2,b.b3 from  B where B.b1= A.a1 and A.a3=100 )

  5. 【Oracle】Update方法

    1.单表更新 update customers set city_name='山西省太原市' where city_name='山西太原' 2.两表(多表)关联update -- 被修改值由另一个表运 ...

  6. oracle中update语句修改多个字段

    如需要修改下列数据:表名为student 一般会这样写: update student set sname = '李四', sage = 20, sbirthday = to_date('2010-0 ...

  7. Oracle中decode方法的作用

    DECODE(条件,值1,翻译值1,值2,翻译值2,...值n,翻译值n,缺省值) 该函数含义如下: IF 条件=值1 THEN    RETURN (翻译值1) ELSIF 条件=值2 THEN   ...

  8. Cocos2d-swift V3.x 中的update方法

    在cocos2d V3.x中update方法如果实现,则会被自动调用;不用向早期的版本那样要显式schedule. 但是你还是要显式schedule其他方法或blocks使用node的schedule ...

  9. SQL Server 2012 中 Update FROM子句

    首先说明一下需求以及环境 创建Table1以及Table2两张表,并插入一下数据 USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.Table1', 'U') ...

随机推荐

  1. renderman、arnold及全局光照

    走马观花看了一些实现全局光(global illumination)的文章,都是非实时电影级的.的确可以分为两个阵营,一是pixar的renderman中常用的reyes+点云,感觉pixar一路走来 ...

  2. 如何执行字符串的PHP代码

    如何执行字符串的PHP代码 最近因项目需要,引出一个议题:如何执行字符串的php代码(php和html混写). 注:传统情况下,php代码存储在文件中,直接运行文件即可.以下讨论的情况是,如果php代 ...

  3. Linux内核分析——分析system_call中断处理过程

    万子惠 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 我选择的是get ...

  4. 使用Application对象简单完成网站总访问人数的统计

      Global.asax文件: using System.IO; protected void Application_Start(object sender, EventArgs e) { Fil ...

  5. 实现TabelView的多个cell布局

    - (void)viewDidLoad { [super viewDidLoad]; self.LabelArray=[[NSMutableArray alloc]initWithObjects:@& ...

  6. Android DownloadProvider学习

    DownloadProvider 简介 DownloadProvider 是Android提供的DownloadManager的增强版,亮点是支持断点下载,提供了“开始下载”,“暂停下载”,“重新下载 ...

  7. C - 搜索

    Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Descr ...

  8. Sigar使用

    Sigar(System Information Gatherer And Reporter),是一个开源的工具,提供了跨平台的系统信息收集的API,核心由C语言实现的.项目中使用Sigar进行服务器 ...

  9. 写给笨蛋徒弟的学习手册(1)——完整C#项目中各个文件含义

    Bin 目录用来存放编译的结果,bin是二进制binrary的英文缩写,因为最初C编译的程序文件都是二进制文件,它有Debug和Release两个版本,分别对应的文件夹为bin/Debug和bin/R ...

  10. 【Cocos2d-x 3.x】 调度器Scheduler类源码分析

    非个人的全部理解,部分摘自cocos官网教程,感谢cocos官网. 在<CCScheduler.h>头文件中,定义了关于调度器的五个类:Timer,TimerTargetSelector, ...