neal,
Wednesday, September 18, 2002, 11:17:49 AM, you wrote:
n> I have a table that will auto increment it's PK field upon adding a new
n> record. I would like obtain that auto-increment value immedicately after
n> the add of that record so that I may reference it within another table ...
n> sort of an informal PK/FK relationship.
n> In SQLServer I believe I recall there was a function something like @@ID to
n> retrieve this value ... could be written directly into your SQL.
n> What sort of function exists in mySQL for this purpose?
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