【问题标题】:copy one row from a table to another and insert value of one column in same query将一行从表复制到另一行并在同一查询中插入一列的值
【发布时间】:2014-07-21 04:28:26
【问题描述】:

我正在从 table2 复制 column1、column2 但想手动在 table1 中插入 column3 的值...我该怎么办?请帮忙

INSERT INTO table1( column1, column2, column3) 
SELECT column1, column2
FROM table2
WHERE  `id` =  '1'

【问题讨论】:

    标签: mysql insert copy


    【解决方案1】:

    喜欢

    INSERT INTO table1( column1, column2, column3) 
    SELECT column1, column2, 'My String' as column3
    FROM table2
    WHERE  `id` =  '1'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-18
      • 2014-06-19
      • 2023-03-17
      • 1970-01-01
      • 2017-11-23
      • 2019-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多