MySQL Forums
Forum List  »  Newbie

retreive last inserted record
Posted by: oliver voegeli
Date: April 08, 2005 06:01AM

hi!

is it possible to retrieve the last row which was inserted?

e.g., I insert a record like this:

"INSERT INTO SONG (Songtitle) VALUES ('purple rain');"

what I need then is the ID (fieldname: sID) of that record, I could retreive it like this:

"SELECT sID FROM SONG WHERE Songtitle = 'purple rain';"

is there a saver method? I mean, no matter what reasons, 'purple rain' could already exist in another record, then I might get the wrong sID...

oliver

Options: ReplyQuote


Subject
Written By
Posted
retreive last inserted record
April 08, 2005 06:01AM


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.