Hmmmm .... you're close, very close.  What you have actually does
work, with a little tweaking - you have an extra set of parens.  I'm
on 5.0.21, FYI.

insert into products (productsid) select max(productsid)+1 from products;

Appears to work for both auto-incrementing and non-auto-inc columns.

Dan


On 8/14/06, William DeMasi <[EMAIL PROTECTED]> wrote:
Does anyone have any ideas of how I can select the max value and insert the
next highest value?

I want something that would do something like this:

Insert into table1 (select max(field1)+1 from table1);

This obviously doesn't work.

I know if the table was set to auto-increment it wouldn't be an issue, but I
am not able to change its schema.

Thank you.

- William


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



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

Reply via email to