let's say i have `table1(col1,col2,col3), the values to insert on col1 and col3 will be the same, but the values to insert on col2 come from the result of a select query.
How can i write my query so i can do this multiple insert at once ? Example of what the query should do :
col1 | col2 | col3
1 val1 0
1 val2 0
1 val3 0
If I understand correctly, you would use insert . . .select
:
insert into table1(col1, col2, col3)
select 1, col2, 0
from <your other query here>;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With