Aamer,
Wednesday, October 30, 2002, 8:34:44 PM, you wrote:
AR> I have a mysql database. Lets say it has a table called "maintable" with primary
AR> key as main_id. I want to add other tables to the database and use main_id as
AR> foriegn keys in those tables. If I want to start with the last row of the
AR> maintable how can I using a perl script get main_id from the last row of the
AR> maintable. Note that maintable and the new added tables will keep growing in
AR> size.
If main_id is an auto_increment field, you can use LAST_INSERT_ID()
function to retrieve inserted value:
http://www.mysql.com/doc/en/Miscellaneous_functions.html
Otherwise you should know what value you have inserted to the table :)
--
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