MySQL INSERT INTO ... VALUES and SELECT
just use a subquery right there like:
INSERT INTO table1 VALUES ("A string", 5, (SELECT ...)).
INSERT INTO table_name1 (id, name, address, contact_number) SELECT id, name, address, contact_number FROM table_name2;
Use an insert ... select
query, and put the known values in the select
:
insert into table1
select 'A string', 5, idTable2
from table2
where ...