copy one row from a table to another and insert value of one column in same query

自闭症网瘾萝莉.ら 提交于 2019-12-23 16:53:47

问题


I am copying column1, column2 from table2 but want to insert value of column3 in table1 manually... what should i do? Please help

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

回答1:


like

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


来源:https://stackoverflow.com/questions/23971078/copy-one-row-from-a-table-to-another-and-insert-value-of-one-column-in-same-quer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!