[SOLVED] need to insert data from SQL table 1 table 2 but one column data is constant

Issue

I need to insert data in table 2 but it has a column 3 which is a constant. How to built query for this comdition

?
INSERT INTO table2 (column1, column2, column3)
SELECT column1, column2
FROM table1
?

Solution

You can just add your constant value after column2 from the select

INSERT INTO table2 (column1, column2, column3) 
SELECT column1, column2, 'your constant value'
FROM table1

Answered By – D-Shih

Answer Checked By – Marilyn (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.