MySQL Forums
Forum List  »  Newbie

Re: auto-increment
Posted by: Nick Roper
Date: May 02, 2005 06:06AM

Or,

SELECT @max_id := MAX(id) FROM table;
INSERT INTO table (id, etc...) VALUES (@max_id + 1, etc...);

(Note: @var := expression
used to assign a value to a SQL variable)

Nick

--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
May 02, 2005 05:17AM
May 02, 2005 05:45AM
May 02, 2005 05:57AM
Re: auto-increment
May 02, 2005 06:06AM


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.