Hello everybody,


I thing, that I have a problem that needs a sequence and that
auto-increment can't do the job this time.

I already consulted the manual and the mailarchive.
I saw several different proposals, now I'm a bit confused and don't
know exactly what the rigth way is to do it.

Could somebody please clarify the following?


We are using ISAM tables on mysql 3.22.32. 

We have an id-column but the id will be generated out of two different ranges.
Example: all VIP-customers will get an id from 1000-9999 and
normal customers from 10000-9999999.

So, I think the only way to solve this is a sequence table.

Lets take a single row, integer value for holding the sequence:
CREATE TABLE sequence(
  id int4;
);


My question is this:
Is this the best way to get and evalute the sequence?

 LOCK TABLES sequence WRITE;
 UPDATE sequence SET id=id+1;
 SELECT id FROM sequence;
 UNLOCK TABLES; 



Thanks 
Gunnar von Boehn  

---------------------------------------------------------------------
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

Reply via email to