On Fri, 19 Dec 2003, K Q-B wrote:
> I am creating a table and would like to use auto
> increment, but I would like one column to increment in
> only odd numbers 1,3,5... and another column of the
> same table to increment in even numbers 2,4,6...
>
> Is it possible to do this?

Not without a little tinkering.
You can use a separate table for just the counters, when you need a new id
generated, you can insert a value into it, then when inserting into the
real table you can use
INSERT INTO table SET id_col  = LAST_INSERT_ID() * 2 ...
(or INSERT INTO table (id_col, ...) VALUES (LAST_INSERT_ID() * 2, ...); )


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to