在SQLite中检索TimeInMillis

时间:2017-09-09 10:17:49

标签: java sqlite android-sqlite

数据库助手

 public Cursor getAllData() {
        SQLiteDatabase db = this.getWritableDatabase();

            Cursor res = db.rawQuery( "SELECT * FROM " + TABLE_NAME, null);
            return res;
        }

我想要的是db.rawQuery("select * From "+TABLE_NAME,null WHERE COLUMN datetimez(today));

1 个答案:

答案 0 :(得分:1)

假设today是变量而COL_5datetimez

Cursor cursor =  db.rawQuery("select * from " + TABLE_NAME + " where " + COL_5+ "='" + today + "'" , null);
        if (cursor.moveToFirst()) 
         {
            do {
                    // your code like get columns
                }
                 while (cursor.moveToNext());
            }
        }