Forum Moderators: coopster
I have a two (largeint) fields in a DB called "in" and "out" and I need to either increase or decrease them by 1 depending on a particular status.
Is there an easy way in MySQL, that avoids me having to read in the value, do the math, then write it back? I'd like to just say "increment `in` by 1", "decriment `out` by 1" etc.
Always going up or down in 1's.
I've tried my favourite search engine, but I keep finding lots of info about "auto-incrementing" fields which, from what I've read, won't help me.
Any input appreciated.
TJ
s1dev's solution is what I needed. Out of interest, does this work with float values?
set `some_float` = `some_float + 0.47`
Thanks,
TJ