Reputation: 792
i am trying to add a select in an insert statement but one of my parameters is not part of the select and i d'ont know how to handle this. would you mind helping me please, thanks
what i want to achieve is :
i wanted to do something like this but i'm not sure it will work
insert into installs_workflows(install_id,action_id,order)
values("myIDhere", (select action,order from installs_actions where ostype=0))
let me know if you don't understand what i'm trying to achieve, thanks.
(in fact, for each result found in the SELECT statement, i want to insert them in the table installs_workflows with a specific install_id (that is the same)
thanks again
ps : or can i add a dmmy value in the select maybe ? this way i could do something like :
insert into installs_workflows(install_id,action_id,order)
select "MyID",action,order from installs_actions where ostype=0
Upvotes: 0
Views: 54
Reputation: 14928
Use a SELECT
directly as
insert into installs_workflows(install_id,action_id,order)
select 'myIDhere', action,order
from installs_actions
where ostype = 0;
Upvotes: 1