update table mytable set id =last_insert_id() + 1 where id = $oldid
2007/7/11, Olav Mørkrid <olav.morkrid@gmail.com>:
>
> using one single sql statement, how do i update the auto_increment id
> column of a row to have the new highest id in the table?
>
> in other words: how do i make a row seem like it was just inserted?
>
> i know how to do it with two statements, but i want to do it with one
> to ensure nothing goes wrong:
>
> $newid = get_value("select max(id) from user") + 1;
> run_query("update table mytable set id = '$newid' where id = '$oldid' ");
>
> hope someone can help. thanks!
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=omelnyk@gmail.com
>
>
--
Sincerely yours,
Olexandr Melnyk
http://omelnyk.net/