WHERE和IN子句组合在android SqLite中

时间:2016-08-03 06:45:00

标签: android sqlite syntax where where-in

我试图从sqlite中检索数据。我想从表格中获取数据' tbl_expense',我的条件很少:

  1. 日期 - 日期过滤
  2. 费用类型(此处为frequencyID)可能属于多个类别。

    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});

  3. 我的频率字符串:(' 1',' 2',' 3')

    我的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)

    注意:在提出问题之前我已经提到了this question,我的不好,我无法从这个问题中找到任何有用的东西。你如何将我的问题与相关问题联系起来? @CL

0 个答案:

没有答案