我想运行一个
INSERT ... SELECT查询插入从一个表到另一个表的确切数量为2行的1选定列列的查询。
在此同时,我还想插入一列静态值。
示例
| selected column | static val |
Variable 4
Variable 9静态值4&9在我的php脚本中指定。我可以在一个mysql查询中这样做,而不是使用php来存储临时数据吗?
发布于 2010-08-03 08:31:54
您可以使用UNION ALL从源表中进行两次选择,如下所示:
insert into new_table
select column, 4 from old_table
union all
select column, 9 from old_table;https://stackoverflow.com/questions/3394840
复制相似问题