I need to insert data to new table which the fields are constructed from two existing tables named Table1 and Table2 as below. The path1 and path2 are from Table2 but the references are stored in Table1. Table1 should not be altered, because Table2’s path field will be changed.
New Table
id path1 path2
1 /a/b /a/c
2 /a/d /a/e
Table1
id path1_id path2_id
1 1 2
2 3 4
Table2
id path
1 /a/b
2 /a/c
3 /a/d
4 /a/e
You didn’t give us much to work with, so here is an attempt just to get the boll rolling:
…based on the following assumptions about your data:
table1.idis a unique keytable2.idis a unique keynew_table.id“inherits” the key from table1table1.path1_id => table2.idtable1.path2_id => table2.id