Het klinkt alsof dit is wat je wilt:
INSERT INTO table1_table2 (table1_id, table2_id)
SELECT MAX(table1.id), table2.id FROM table1, table2 GROUP BY table2.id;
Het klinkt alsof dit is wat je wilt:
INSERT INTO table1_table2 (table1_id, table2_id)
SELECT MAX(table1.id), table2.id FROM table1, table2 GROUP BY table2.id;