0

I want to insert a column of other table and one parameter of this table have a hard coded value. I want to iterate this value with the each return value of other table column. How can i do this with insert query?

let 3,4,6 is the return column value of other table.

insert into table(value1,value2)
values (2,select id from table2)

Return column

2       3
2       4
2       6
2
  • 1
    Your question alludes to two tables, and you have only shown one. The question is hard to follow without appropriate sample data and desired results. Commented Jul 25, 2020 at 13:45
  • I have changed it. I hope now it'll be clear for you Commented Jul 25, 2020 at 13:48

1 Answer 1

4

Get rid of the values clause:

insert into table(value1,value2)
select 2, id 
from table2
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.