MySQL Forums
Forum List  »  Oracle

Re: How to generate sequence in MySql
Posted by: Rick Siner
Date: March 26, 2007 09:31PM

Ok, I initially posted a follow-up on this pleading for the same type of information, however I think I found what I was looking for.

The use of the "last_insert_id()" function meets my needs. You can find the official MySql folks documentation at: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html

The basic overview is that this function, called like: select last_insert_id();

and will return the sequence ID generated from the previous insert query into a table where an auto_increment column existed. I'm simplifying this a bit, but basically if you are doing simple inserts into a table, and want to know what the ID was that is generated from the insert, this works.

It met my need.

BTW - I'm running the lastest distro as of this post - 5.0.37 of the community version of the DB.



Edited 2 time(s). Last edit at 03/26/2007 11:59PM by Rick Siner.

Options: ReplyQuote


Subject
Views
Written By
Posted
167462
March 13, 2007 08:05AM
Re: How to generate sequence in MySql
53638
March 26, 2007 09:31PM
30772
April 04, 2007 03:00AM
26416
November 21, 2007 03:50AM
17602
February 06, 2008 12:16PM
18391
October 15, 2008 01:03PM
12303
November 05, 2008 09:50AM
14128
November 10, 2008 06:32AM
15568
December 14, 2008 07:08AM
18342
January 23, 2009 05:38PM


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.