On Monday 01 July 2002 10:29, W. Enserink wrote: > Hi all, You would just do something like
SELECT max(idcolumn)+1 as nextvalue FROM tablename where idcolumn is the name of the column and tablename is the name of your table, but remember that you may need to serialize this, since probably the NEXT thing you're going to do is insert into another table using that id number, and you don't want someone else to grab it in the meantime. The traditional way is to issue a lock on the table, but with InnoDB tables you should be able to do it with a transaction. > > > Does anybody know if there is a function to retrieve the next unique ID > number for a record to be made in the future? > > > thx. Wilbert > > mysql query for next unique ID > > ------------------------- > Pas de Deux > Van Mierisstraat 25 > 2526 NM Den Haag > tel 070 4450855 > fax 070 4450852 > http://www.pdd.nl > [EMAIL PROTECTED] > ------------------------- > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- 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