繁体   English   中英

Oracle SQL:使用来自同一表的其他列的数据更新表

[英]Oracle SQL: Update a table with data from another columns of the same table

表:名称

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

您是否只想进行简单的update

update names
    set namemaster = name;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM