Creating Records that Link to Groups of Records on Other Table

Hi! I’m new to scripting in Airtable and trying to figure out how to do something. I have 3 tables: Table3 contains a linked field to Table1 and a linked field to Table2, each limited to one record, along with a lookup field to a field in Table2.

I would like to have a 4th table that automatically creates and updates one record for each combination of Table1 and Table2 that is contained on a record in Table3 that has a certain value in the look up field. It should contain a field that links to every record on Table3 that matches the linked field values for Table1 and Table2.

Any help you could provide would be very much appreciated.

Thanks!