Re: Incrementing using Max(Field) ?

2006-08-15 Thread Visolve DB TEAM
15, 2006 12:34 AM Subject: Incrementing using Max(Field) ? 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

RE: Incrementing using Max(Field) ?

2006-08-15 Thread William DeMasi
Thank you very much! -Original Message- From: Visolve DB TEAM [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 15, 2006 12:44 PM To: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: Incrementing using Max(Field) ? Hello William Try the below Query to insert next maximum value

Re: Incrementing using Max(Field) ?

2006-08-15 Thread obed
On 8/15/06, Visolve DB TEAM [EMAIL PROTECTED] wrote: Hello William Try the below Query to insert next maximum value of the field into same table INSERT INTO Sample(id) SELECT MAX(id)+1 FROM Sample Wooww it works :D ... i didn't know that... great ! -- MySQL General Mailing List For

Re: Incrementing using Max(Field) ?

2006-08-15 Thread Chris W
obed wrote: On 8/15/06, Visolve DB TEAM [EMAIL PROTECTED] wrote: Hello William Try the below Query to insert next maximum value of the field into same table INSERT INTO Sample(id) SELECT MAX(id)+1 FROM Sample Wooww it works :D ... i didn't know that... great ! Wouldn't this cause

Re: Incrementing using Max(Field) ?

2006-08-15 Thread Philip Hallstrom
On 8/15/06, Visolve DB TEAM [EMAIL PROTECTED] wrote: Hello William Try the below Query to insert next maximum value of the field into same table INSERT INTO Sample(id) SELECT MAX(id)+1 FROM Sample Wooww it works :D ... i didn't know that... great ! Wouldn't this cause a problem if

Incrementing using Max(Field) ?

2006-08-14 Thread William DeMasi
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

Re: Incrementing using Max(Field) ?

2006-08-14 Thread obed
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

Re: Incrementing using Max(Field) ?

2006-08-14 Thread Dan Buettner
H 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.