Increment a column value
by Guna[ Edit ] 2010-09-28 13:52:27
Following query will update a column value by incrementing its value by 1
update TABLE set COLUMN=COLUMN+1 where CONDITION.
Example:
update mytable set id=id+1 where user='test'
the above code will increment id field value by 1 which has user as test
This query also works with varchar type fields.