Mark,
Monday, November 11, 2002, 11:53:38 AM, you wrote:
>> I wonder if there is an more efficient way to do the following:
>> I have 2 tables -
>>
>> The user submits a new record into table A and an id (primary key) is
>> created using the auto-increment.
>> At the time that the new record is created in table A I need to insert the
>> newly created id from table A into a column in table B. Is there a way to
MS> do
>> this without performing multiple queries to either table?
Take a look at LAST_INSERT_ID():
http://www.mysql.com/doc/en/Miscellaneous_functions.html
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Egor Egorov
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php