Update table field to value plus constant in MYSQL without PHP
I would like to execute UPDATE
in MYSQL
which I take the value of a field, add a constant and store the new value in the same field.
Suppose we have a named column OldValue
in a table named aTable
.
The pseudocode could be:
UPDATE aTable SET OldValue = OldValue + 220 WHERE someField = someValue
Do you have any ideas on how I can do this? I would like to use a single request (in some dashboard) without creating a php
script. (Of course, in this case, the answer is pretty simple.)
source to share
Your code will work.
See how it works in SQLFiddle .
I used your exact query verbatim, except for replacing the real value for "someValue".