【问题标题】:update a whole column with the values of another column of another table mysql用另一个表mysql的另一列的值更新一整列
【发布时间】:2013-11-30 16:25:04
【问题描述】:

我有一个名为 table1 的表,如下所示:

column1 column2 .. columnX 命名 otherColumns

                      John  
                      Paul  
                      Paul  
                      Jimmy  
                      Fred  
                      Mary

我只知道 table1 中的 Name 列。
因此,在我的应用程序中,我读取了整个名称列并加密了每个值。
现在我必须用它们的加密值更新 table1 的名称。
我能做些什么? (抱歉表格格式不正确..)

【问题讨论】:

    标签: mysql sql


    【解决方案1】:

    假设您有另一个表,其中包含 NameEncryptedName 等列,您可以使用 join 执行 update

    update table1 t1 join
           NamePairs np
           on t1.name = np.name
        set t1.name = np.EncryptedName;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-08
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-18
      • 2022-01-23
      相关资源
      最近更新 更多