At 16:57 +0200 10/21/02, Joseph Bueno wrote:
Hi all,
Sorry to jump in the middle of this thread but there is a much simpler
way to generate sequence numbers:
You create an auxiliary table with a one row:
CREATE TABLE sequence (
code int(11) DEFAULT '0' NOT NULL
);
INSERT INTO sequence VALUES (0);
And, each time you need a new sequence number:
UPDATE sequence SET code=LAST_INSERT_ID(code+1);
SELECT LAST_INSERT_ID();
We use this method in our applications and it works well.
(and I didn't invent it, it is described in Paul DuBois'book ;))
And I didn't invent it, either, it's described in the MySQL manual! :-)
---------------------------------------------------------------------
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