abh
abh

Reputation: 1239

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

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'

Upvotes: 3

Views: 1573

Answers (1)

Rufinus
Rufinus

Reputation: 30741

like

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

Upvotes: 6

Related Questions