我在数据库中有一个这样的表:
db.execSQL(" CREATE TABLE IF NOT EXISTS "
+ DATABASE_TABLE + " ( " + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_DATE + " TEXT, " + KEY_CATEGORY + " TEXT, "
+ KEY_SUB_CATEGORY + " TEXT, " + KEY_AMOUNT + " REAL, "
+ KEY_NOTE + " TEXT " + " );");
我想获取 KEY_CATEGORY = ("Income" or "Expense" ) 和 KEY_DATE = "March 2013" 的 trans_amount 值。
我如何查询才能得到它?我目前正在使用
db.ourDatabase.query(DATABASE_TABLE,
new String[] { KEY_AMOUNT } , " ( "
+ KEY_CATEGORY + " = ? OR "
+ KEY_CATEGORY + " = ? ) AND " + KEY_DATE + " = ? " ,
new String[] { " VariableExpenses " , " FixedExpenses ", " March/08/2013 " },
null, null, null, null);
但我没有得到 KEY_AMOUNT 值。我在查询中遗漏了什么吗?