Try this...works on 4.1.2 UPDATE ControlTable SET NextID= 1 + (select @prevval := NextID)
Ed -----Original Message----- From: Sasha Pachev [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 11:19 AM To: Matt Fagan Cc: [EMAIL PROTECTED] Subject: Re: Setting variables on update Matt Fagan wrote: > Hello, > > I'm trying to run an SQL update statement like: > > UPDATE ControlTable SET @prevval := NextID, NextID = NextID > + 1 > > I've tried using a range of different syntax, but nothing > seems to work. This is something that does work in another > SQL server I used to use. > > Does anybody know if this is something MySQL can do, and if > so, what is the correct syntax? Note that I can't use an > autoincrement column because the IDs aren't being put into > a database. > > I've searched through MySQL docs and mailing lists but > couldn't find any mention of this. Any help would be > appreciated. A UDF or your own static function might work. Worst case, MySQL source can be modified to make this work. -- Sasha Pachev Create online surveys at http://www.surveyz.com/ -- 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]