Maybe I'm just looking in the wrong corners of google but I don't understand this so if someone could explain:
I've got a table in Access that I'm inserting records into with Java ucanaccess. It has too many columns so I'm splitting up the table but the relationship between table a and b will be one to one.
I don't understand how to relate a record in the two tables during an INSERT query.
Table a has an autoincrement PK so then if I put table a PK as a foreign key in table b will it also increment automatically if they are related?
Say table a and b are as follows
//Table Pt
H_id, Age
1, 18
2, 44
//Table Imp
Imp_id, result, H_id
343, no, 1
252, yes, 2
And then to do the insertion in two steps (I assume)- how to I make sure that the key from the insert in table Pt can then be used as the FK in table Imp My statement (in java
String stg = "INSERT INTO Pt (Age) VALUES('18','44')";
qu.execute(stg);
String stg2 = "INSERT INTO Imp (result) VALUES('no','yes')";
qu.execute(stg2); //How do i retrieve the H_id from the first INSERT to then insert it into the second INSERT?