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. java 实现一个简易计算器

    import java.util.Scanner;public class Test { public static void main(String[] args) { count(); } pub ...

  2. JAVAWEB学习总结 SERVLET开发(二)

    一.ServletConfig对象 1.1.配置servlet初始化参数 在servlet的配置文件中web.xml中,可以使用一个或多个<init-param>标签为servlet配置一 ...

  3. css基本设置

    css引入方式: 头部引入:在HTML页面头部编写程序(一般用在访问量大的网页上) 标签内引入:在标签内直接写样式(优先级最高,但难于维护,会沉积大量代码) 外部引入:用link标签引入(常用 ,维护 ...

  4. [驱动开发] windbg符号表

    新建"环境变量 - 系统":_NT_SYMBOL_PATH 值为:SRV*FullDirPath*http://msdl.microsoft.com/download/symbol ...

  5. GCD: 基本概念和Dispatch Queue 【转】

    什么是GCD? Grand Central Dispatch或者GCD,是一套低层API,提供了一种新的方法来进行并发程序编写.从基本功能上讲,GCD有点像 NSOperationQueue,他们都允 ...

  6. Weibo SDK WP版本回调参数没有uid的解决方法

    服务端跟新浪微博交互的时候需要用到UID参数, 但WP的WeiboSDK默认没有提供, 只要增加一个类成员就好了, 序列化json的时候程序会自动处理 下载SDK源代码http://weibowp7s ...

  7. 使用Burpsuite抓取手机APP的HTTPS数据

    1.所需条件 · 手机已经获取root权限 · 手机已经成功安装xposed框架 · 电脑一台 2.详细步骤 2.1 在手机上面安装xposed JustTrustMe JustTrustMe是一个去 ...

  8. 如何通过 js 修改微信浏览器的title?

    document.setTitle = function(t) { document.title = t; var i = document.createElement('iframe'); i.sr ...

  9. java单例-积木系列

    一步步知识点归纳吧,把以前似懂非懂,了解表面,知道点不知道面的知识归一下档.   懒汉式单例: 私有化构造函数,阻止外界实例话对象,调用getInstance静态方法,判断是否已经实例化. 为什么是懒 ...

  10. eclipse创建maven web项目

    eclipse创建maven web项目: 1.安装eclipse maven插件 2.新建maven project选择webapp模板. 3.改造为maven文档结构. 4.添加项目的JAVAEE ...