I'm trying to replace all fields "name" by "name+1" in one update. For example, i want that 2008 become 2009, 2009 become 2010, etc.
I did this for just one replace :
UPDATE table
SET name = REPLACE(name, '2008', '2009');
But if i want to replace now 2009 by 2010, it will be wrong because it will change also 2009 of my last request.
Here is my db :
How can i increment all of these years "name" in one request without conflict and without start by the latest year ?
Thanks for your time.
Just use casting
( as unsigned for numeric type )
update table
set name = cast(name as unsigned) + 1;
considering your column(name
) contains integer year values only.