I have two tables that are indirectly related by another table
TableA - ID, SomeFieldA TableB - ID, SomeFieldB TableAB - IDA, IDB, SomeFiel
TableA - ID, SomeFieldA
TableB - ID, SomeFieldB
TableAB - IDA, IDB, SomeFiel
You can do this:
select a.*, b.* from a, b
This will do a cross join which will give you all possible combinations.
From there, it's simple to use that within the context of an INSERT statement to populate your AB table.