【问题标题】:Oracle SQL: Update a table with data from another columns of the same tableOracle SQL:使用来自同一表的另一列的数据更新表
【发布时间】:2019-09-11 20:55:15
【问题描述】:

表格:名称

Id  name    namemaster
--  ----    ----------
1   tomato  tomato/999
2   lettuce lettuce/999
3   carrot  carrot/999

在 oracle SQL 中,如何运行一个 sql 更新查询,该查询可以使用相同的 id 使用表列“names.name”的名称更新表列“names.namemaster”? 所以我得到的最终结果是:

表格:名称

Id  name    namemaster
--  ----    ----------
1   tomato  tomato
2   lettuce lettuce
3   carrot  carrot

【问题讨论】:

    标签: sql oracle sql-update


    【解决方案1】:

    你只想要一个简单的update吗?

    update names
        set namemaster = name;
    

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 1970-01-01
      • 1970-01-01
      • 2018-04-23
      • 2012-06-13
      • 1970-01-01
      • 2019-09-07
      • 1970-01-01
      • 2021-09-17
      相关资源
      最近更新 更多