将表中的一行复制到另一行,并在同一查询中插入一列的值 [英] copy one row from a table to another and insert value of one column in same query

查看:84
本文介绍了将表中的一行复制到另一行,并在同一查询中插入一列的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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'


推荐答案

like

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

这篇关于将表中的一行复制到另一行,并在同一查询中插入一列的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆