Answer the question
In order to leave comments, you need to log in
How to properly set SQLite IN Condition in Android?
Hello!
It is necessary to extract from the database all the records that match the condition (COLUMN_ICON == value1 or value2 or value3 ... etc.)
I'm trying to do it like this:
final String SELECTION = MySQLiteHelper.COLUMN_ICON + " IN ";
final String[] SELECTION_ARGS = {"default_red", "default_blue"};
Cursor cursor = mDatabase.query(MySQLiteHelper.TABLE_NOTES,
allColumns,
SELECTION,
SELECTION_ARGS,
null, null,
MySQLiteHelper.COLUMN_ID);
Caused by: android.database.sqlite.SQLiteException: near "ORDER": syntax error (code 1): , while compiling:
SELECT _id, text, title, icon FROM notes WHERE icon IN ORDER BY _id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question