'How to insert values of s column to another column of the same name. Also, I need to insert other values for different fields in the target column

Query to insert values of a column from one table to another table column with same name. Also hardcode remaining values in same query

Suppose we have two tables. I tried the following query ;

Insert into table A (date, ICN, script)
values ('date', '(select ICN from table B)', 'script name')
sql


Solution 1:[1]

Combining hard-coded values and a table B as a source

Insert into  A (date, ICN, script) 
select 'date', ICN , 'script name'
from B
where ..<specify criteria to get paticular rows from B>

Omit WHERE only if all the B rows are relevant.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1