Use an insert ... select query, and put the known values in the select:
insert into table1
select 'A string', 5, idTable2
from table2
where ...
Use an insert ... select query, and put the known values in the select:
insert into table1
select 'A string', 5, idTable2
from table2
where ...