I use SQLite Databases for date and time using separate Integer fields in the form:

 Year / month / day 2016 9 13 

Sending request:

 cursor = db.rawQuery("select * from " + DataBase.TABLE_NAME + " where type='Все'"+ " and month=9 and day<13 and day>6" 

The result is zero, although there are records.

  • 2
    And what is this "where type = 'All'" "? And there you haven’t completed the line. - Lucky_girl
  • In SQLite Browser 'e, I use exactly this query. there gives results. but in Android studio does not work - Temirlan Abdullaev
  • one
    If you want to select all records in Android in SQLite, then you do not need to write "where type = 'All'" " - Lucky_girl
  • and you don't have the second parameter, so it should look like this: cursor = db.rawQuery ("select * from" + DataBase.TABLE_NAME + "where month = 9 and day <13 and day> 6", null); - Lucky_girl
  • How do you know that Результат ноль ? What does this even mean? - Vladyslav Matviienko

2 answers 2

First you need to correctly write an entry in db.rawQuery (), namely, specify the second parameter:

 cursor = db.rawQuery("select * from " + DataBase.TABLE_NAME + " where month=9 and day<13 and day>6",null); 

Next you need to check:

1) is there a table in the database for which you are sampling 2) Check what data is in the table 3) Check the name of the fields for which you write the condition in rawQuery

    @Lucky_girl thanks. Solved a problem. Initially saved columns as String. In the phone, these records are preserved. And then I decided to use Integer but did not clear the table. The query was searched not by the value of String.Length Therefore, the query returned 0 strings.