L
L
lightalex2015-01-24 21:26:53
PHP
lightalex, 2015-01-24 21:26:53

Is it possible to increase an int field by one in one mysql query?

Hello!
It became interesting, is it possible to increase an int field by one through one mysql query?
That is, there is a num attribute.
We write some query specifying a record (let's say 'WHERE id=1') and change the value of num to num+1 . Otherwise
, we did select first and then update
. Maybe there is a simpler way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1-800-IT, 2015-01-24
@lightalex

SET `int_field_name` = `int_field_name` + 1 ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question