I was trying to retrieve data from sqlite. I want to get data from table 'tbl_expense', I have few conditions:
- Date - Date filtering
Expense type(here frequencyID) may fall in multiple categories.
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_OFFICE_EXPENSES + "WHERE " + DATE + " > ? AND (" + DATE + " < ? AND " + FREQUENCY_ID + " IN ?)" + " ORDER BY " + DATE + " ASC", new String[]{dateFrom, dateTo, frequencyString});
my frequency String : ('1', '2', '3')
my StackTrace: android.database.sqlite.SQLiteException: near "?": syntax error (Sqlite code 1): , while compiling: SELECT * FROM tbl_expense_office WHERE date_paid > ? AND (date_paid < ? AND frequency_id IN ? ) ORDER BY date_paid ASC, (OS error - 2:No such file or directory)
NB: I have referred this question before asking my question, My bad, I couldn't find anything helpful from that question. How do you relate my question to the linked question? @CL