I have 3 tables.
Each table has its own primary key "id"
table 2 has a foreign key that references table 1's primary key
table 3 has a foreign key that references table 2's primary key.
I want to add to t.3 the foreign key that links t.2 – t.1 so that t.3 is also linked to t.1. I cant figure out how to copy the relevant column from t.2 to t.3.
Best Answer
That depends on youir table definition .
If your id fileds are auto increment
db<>fiddle here
In other cases you have to get the last id number from the father table, which is dependent on which type if id you have.