At 13:49 +0200 2001-06-26, Gunnar von Boehn wrote:
>Lets take a single row, integer value for holding the sequence:
>CREATE TABLE sequence(
>   id int4;
>);

That works, though I would use a single table for all sequences, not 
a new table per sequence.

The other solution would be to do check the table itself what the maximum is:

LOCK tables customer WRITE
SELECT MAX(id) FORM customer WHERE id < 10000; ## your first normal customer
INSERT INTO customer SET id=#new_id#, ...
UNLOCK TABLES

though MySQL's optimizer doesn't understand how to do find a ranged 
maximum by checking the index on the ID, so it's not a fast solution 
at present.


=> Hello MySQL developers: Please add that. Same for the equivalent 
"... ORDER BY id DESC  LIMIT 1"
-- 
Matthias Urlichs

---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to