
September 15th, 2004, 11:33 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Insert ???
Sorry for this basic question but I just want to make sure I am using the best possible technique. My question is on inserting data into two tables from one form. The tables are a "Coach" table and a "Address" table. The "Coach" table contains a foreign key from the "address" table that has a primary key, which is incremental. How do I get that foreign key in the "Coach" table to equal the primary key in the "Address" table which in auto added and incremented by 1??
Do I need to use 2 insert statements or can I do it with just one?
The only way I can think is to insert the address info first and then run a query to find out what value the primary key was assigned. Then insert that value into the "Coach" table to link it back to the address. I hope that someone can follow this mess. Thanks in advance for any assistants.
|