나는 현재 날짜에 따라 날짜에 따라 데이터베이스에서 데이터를 검색합니다. 17/09/2016 이 날짜에 저장되는 데이터는 문제점을 보여 주며 하나의 데이터 만 표시하고 데이터베이스에있는 많은 데이터가 있으면이 문제에서 벗어날 수 있습니다. 바보 같은 질문이지만 2 일에서 3 일 사이에 붙어 있습니다.날짜에 따라 sqlite에서 모든 데이터를 다시 얻는 방법
sqLiteDatabase.rawQuery("SELECT * from mytable where Date = (select max(Date) from mytable WHERE Date < DATE('now'));", null);
Cursor c = sqLiteDatabase.rawQuery("SELECT * from BluetoothDevice WHERE Date = date('now');", null);
while (c.moveToNext()) {
Date date = new Date();
date.setTime(Long.valueOf(c.getString(c.getColumnIndex("Date"))));
result.add(
new BluetoothDevice(
c.getString(c.getColumnIndex("Device")),
c.getString(c.getColumnIndex("Address")),
date
)
);
}
c.close();
return result;
}
행을 읽는 코드를 표시하십시오. –
editd 내 질문 – Badprince
항상 날짜를 저장하십시오! – XxGoliathusxX