I have tried to browse it here, but i couldn’t find a solution. The problem is,
I have a database, and i want to update a column in the database, such that the updated value is 1 less than the previous..
Basically, in SQL, it UPDATE TABLE TNAME SET VAL=VAL-1 where
How do i do that in Android?
I tried doing this
ContentValues args = new ContentValues();
args.put(KEY_ROWID, "KEY_ROWID-1");
db.update(DATABASE_TABLE, args, KEY_ROWID + ">0", null);
But this doesn’t work.
I will be thankful if you can help me with this!
Nithin
If you already have a working SQL-syntax, there is no need to “build” it in Android. You can for example use a PreparedStatement (which accepts an SQL-String) and use your Query there.
A nice example can be found here.