Note that there are some explanatory texts on larger screens.

plurals
  1. POSql statement with BETWEEN - what's wrong with it?
    primarykey
    data
    text
    <p>empty (not null!)I want to create sql statement as this:</p> <pre><code>SELECT * FROM table WHERE date BETWEEN ? AND ? ORDER BY date ASC LIMIT 1 </code></pre> <p>I have a sql in database as this^</p> <pre><code> Cursor cursor = context.getContentResolver().query( URI, new String[] { col_id, col_2,DATE }, DATE + " BETWEEN ? AND ?" , new String[] {dateAsString, stopDate)} , DATE + " ASC LIMIT 1"); cursor = database.query( table, projection, selection, selectionArgs, null, null, sortOrder); </code></pre> <p>Sql is passed by cursor is null. I copy database to sd card and see it via <code>SQLiteManager</code> plugin to FF -0 all data exists and the statement above works in console, so something wring with my sql statement.</p> <p>Could you tell me wat's wrong wtih that?</p> <p><strong>UPDATE</strong> extend question</p> <p>I store some data which has column Date that saved as: </p> <ol> <li>2012-11-30 09:12:29.392 which pattern yyyy-MM-dd HH:mm:s.S</li> <li>Convert this to long and save it to TEXT type of columns in my table</li> <li>So I got something like that 1354197364633</li> </ol> <p>I want to get row which date in databse beetween two values:</p> <pre><code>database.rawQuery("SELECT * FROM Track WHERE Date BETWEEN ? AND ?", selectionArgs); </code></pre> <p>But I don't succeeded in it. Now I know that is doesn't work at any database but doesn't got a solution. Could you suggest the way how I can resolve my issue?</p> <p>I try to use the solution below. So in cursor I get this query:</p> <pre><code>SQLiteQuery: SELECT * FROM Track WHERE Date BETWEEN CAST(? AS INT) AND CAST(? AS INT) </code></pre> <p>with this parameters in mBindArgs:</p> <pre><code>{1=1354248261841, 2=1354262663195} </code></pre> <p>I check the date value in track, it lays beyween them, but cursor still returned empty. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload