August 3rd, 2008, 10:45 PM
Add value to existing field with one query
I want to add a value to a value that is already in the DB.
For example sake this is what I would like to do:
$ValueToAddToDB = 4
UPDATE mytable SET field=add($ValueToAddToDB) WHERE id=555
So in the above example, if "field was already 100, it would now be 104 after the update ran.
Is there a mySQL function like add or sum?
August 3rd, 2008, 10:54 PM
Thanks for posting the answer, I am assuming it works when subtracting or otherwise changing a value, because putting the field name into the right side of the definition makes it like a variable in an equation.
Originally Posted by gbrent