Rohit Rohit - 14 days ago 5
Android Question

SQLite database update query with multiple where conditions in Android

I want to update my database table with multiple where conditions. I already did with single where condition

db.update(TABLE_MISSING_ITEMS, values, KEY_AUTHOR + " = ?",
new String[] { String.valueOf(items.getAuthor()) });


Now i want 2 where condition.

P.S :- No raw query

Answer

You can separate the different WHERE conditions with ANDlike this:

db.update(TABLE_NAME,
    contentValues,
    NAME + " = ? AND " + LASTNAME + " = ?",
    new String[]{"Manas", "Bajaj"});
Comments