Reputation: 270
I'm trying to prepare an android app
.
I have an column in SQLite Database
with type as integer
.
For Example the value
of the integer
in Database
is 10
. Now i want to update the value
of that integer
to by adding
another value
i have say 5
.
So finally i want to update
the integer
value
in Database
to 15
.
Which is the better solution to update
the integer
value
in Database
among below options
i) Get the Integer
value
from Database
say 10
, then add
the value
i have say 5
and update
that integer
value
in Database
.
ii) Is there any way to add
value
i have say 5
directly to integer
value
in Database
say 10
Thank You in advance
Upvotes: 0
Views: 1834
Reputation: 1074
Try something like this:
UPDATE table SET value = value + 5 WHERE id = 1;
Upvotes: 2