MySQL Forums
Forum List  »  Newbie

Re: Index on 2 different tables
Posted by: Nick Roper
Date: August 14, 2004 03:07PM

Eroc,

You can grab the value by using the LAST_INSERT_ID() function:

INSERT INTO foo (auto,text) VALUES(NULL,'text');
INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text');

for more info, see:

http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html

Nick

--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
August 14, 2004 01:33PM
Re: Index on 2 different tables
August 14, 2004 03:07PM
August 15, 2004 01:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.