Hi so I was wondering what the best way to add or subtract from a field in my table would be. The way I know it would work is if I query the value do the addition and then UPDATE the value.
I would rather include the addition as part of the update query like:
UPDATE users SET points = +10
Or something like that. Is it possible?
You just need to name the column on the right hand side of the =
operator:
UPDATE `users` SET `points` = `points`+10
Since there is no WHERE
clause this will give all users 10 more points then they currently have.
You can just do this:
UPDATE users SET points = points + 10