zoukankan      html  css  js  c++  java
  • UPDATE

    改(UPDATE)

    1.更新特定值。

    2.根据表中某列来更新。

    3.跨表更新

    select  *  from new.dbo.消费
    update new.dbo.消费 set 日期 = '2019-03-12'      --更新特定值
    select  *  from new.dbo.消费
    update new.dbo.消费 set 日期 = 更新时间 +1        --根据某一列更新
    select  *  from new.dbo.消费
    
    
    --跨表更新
    --方法一
    select * from new.dbo.city  
    update new.dbo.消费 set 城市 = city.城市 from city  where 消费.数值 = city.数值 
    select  *  from new.dbo.消费       --如果city中没有对应的数值则不更新,比如郑州。
    --方法二
    update new.dbo.city set 数值 = 数值 + 1
    update t1 set t1.数值 = t2.数值 from new.dbo.消费 AS T1,city as T2  where T1.城市  = T2.城市  
    select  *  from new.dbo.消费 

  • 相关阅读:
    从小到大全排列
    众数-摩尔投票法
    链表复制
    2019.8.29刷题统计
    2019.8.28刷题统计
    2019.8.27刷题统计
    2019.8.26
    2019.8.25刷题统计
    2019.8.24
    2019.8.23刷题统计
  • 原文地址:https://www.cnblogs.com/qianslup/p/10976709.html
Copyright © 2011-2022 走看看