zoukankan      html  css  js  c++  java
  • Sql Server 与 Oracle 的多表提交

    sql server 语法 :

      update a  set a.jhjg = b.jhjg from yk_ck02 a,yk_ypcd b where a.ypxh=b.ypxh and a.ypcd = b.ypcd and a.xtsb = 2 and a.ckdh = 100028 and a.ckfs=12 and a.jhjg = 0

     

    Oracle 语法:

        update tab1 a set (a.col1, a.col2)= (select b.col_1, b.col_2 from tab2 b where a.col3=b.col_3)

        将tab1表 col1,col2的值全部更新,更新的值为select b.col_1, b.col_2from tab2 b where a.col3=b.col_3,注意:如果tab1 a中有a.col3 !=b.col_3的记录,

    col1,col2字段将更新为空值,如果col1,col2字段不允许为空,sql语句执行会出错,SQL语句 应改为:

         update tab1 a set (a.col1, a.col2)= (select b.col_1, b.col_2 from tab2 b where a.col3=b.col_3) where exists (select 1 from tab2 b where a.col3=b.col_3)

     

    MySQL 示例: update landleveldata a, gdqlpj b set a.gqdltks= b.gqdltks, a.bztks= b.bztks where a.GEO_Code=b.lxqdm

  • 相关阅读:
    2014年广州区域赛k题解
    2014年广州区域赛e题解
    2014年广州区域赛i题解
    最大化平均值问题
    codeforces 976e 题解
    maven
    机器学习入门
    拟合
    插值
    熵权法
  • 原文地址:https://www.cnblogs.com/rxie/p/2461195.html
Copyright © 2011-2022 走看看