N
Niniel
Hello,
I have three related tables, A, B and C, with both A and B being in a
1-to-many relationship with C. A-> C <- B
I want to populate table C by taking one record [ID] from table A and many
records [IDs] from table B, and have in table C - which contains fields with
FKs from both table A and B's PK IDs - a number of records with one and the
same FK from table A, but all the different FKs from table C.
table A - PK ID A: 1
table B - PK ID B: 1/2/3
=> table C: FK A: 1/1/1
FK B: 1/2/3
In other words, if table B has 10 records, I need table C also to have 10
records, but each with the same FK from table A.
I think appending will do this, so I created an Append query. Unfortunately,
it only wants to append 0 records, so I must be missing something.
INSERT INTO tblC ( aID, bID )
SELECT tblA.aID, tblB.bID
FROM tblB INNER JOIN (tblA INNER JOIN tblC ON tblA.aID = tblC.aID) ON
tblB.bID = tblC.bID;
I have three related tables, A, B and C, with both A and B being in a
1-to-many relationship with C. A-> C <- B
I want to populate table C by taking one record [ID] from table A and many
records [IDs] from table B, and have in table C - which contains fields with
FKs from both table A and B's PK IDs - a number of records with one and the
same FK from table A, but all the different FKs from table C.
table A - PK ID A: 1
table B - PK ID B: 1/2/3
=> table C: FK A: 1/1/1
FK B: 1/2/3
In other words, if table B has 10 records, I need table C also to have 10
records, but each with the same FK from table A.
I think appending will do this, so I created an Append query. Unfortunately,
it only wants to append 0 records, so I must be missing something.
INSERT INTO tblC ( aID, bID )
SELECT tblA.aID, tblB.bID
FROM tblB INNER JOIN (tblA INNER JOIN tblC ON tblA.aID = tblC.aID) ON
tblB.bID = tblC.bID;