Mysql – Decrement in thesql goes past zero

decrementlimitMySQL

I am trying to do this in mysql:

UPDATE table SET value = value – 1 WHERE blah blah

If value is 0 and this is run value is set to 4294967295. This is because it is an unsigned integer so it is looping round back to the maximum value.

How would I go about making it stay on zero instead? Can I do this purely in the sql?

Best Answer

`AND value > 0`