只是好奇,是date
保留字 iSQLite
吗?我有一个名为 date 的列,并尝试运行此查询:
DELETE FROM cases WHERE date <= date('now','-1 day')
通过做这个:
String query = "DELETE FROM cases WHERE date <= date('now','-1 day')";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
boolean found = cursor.moveToFirst();
if(found) {
int result = cursor.getCount();
Log.w("DeleteOldCases: ", "Result: " + Integer.toString(result));
db.close();
}
但是,当调用moveToFirst
. 但在我的数据库中,实际上有超过一天的行。任何人都可以解释这里有什么问题吗?
谢谢!