Page 1 of 1

Increment an INT

Posted: Sat Jul 10, 2004 7:30 pm
by James M.
HI, is there any way I can just increment an INT in MySQL without selecting, then incrementing, then updating? Thanks for any help.

Posted: Sat Jul 10, 2004 8:48 pm
by feyd

Code: Select all

UPDATE tablename SET `int_field` = `int_field` + 1 WHERE `some_cond` = 2

Posted: Sat Jul 10, 2004 9:34 pm
by James M.
Thanks, i didn't think that would have worked.