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:

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

Written By
March 13, 2007 08:05AM
Re: How to generate sequence in MySql
March 26, 2007 09:31PM
April 04, 2007 03:00AM
November 21, 2007 03:50AM
February 06, 2008 12:16PM
October 15, 2008 01:03PM
November 05, 2008 09:50AM
November 10, 2008 06:32AM
December 14, 2008 07:08AM
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.