wait, let's make it even more interesting :)

what if you want to update more than one row, and each row should have
a successive new id. is that possible in one statement?

i tried just removing the where statement in barons suggestion, which
fails as i guess the select is computed only once prior to being used
in the update/set.

mysql> update test set id = (select id + 1 from ( select max(id) as id
from test ) as x);
ERROR 1062 (23000): Duplicate entry '424' for key 1

is it possible, or do i have to do the rows one by one?

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

Reply via email to