On Mon, Jan 23, 2012 at 9:29 AM, Steffen Mangold <
steffen.mang...@balticsd.de> wrote:

> Hi SQLITE community,
>
> I think i found a strange bug.
> Lets say we have a table in this form:
>
> Id (long)              |             Timestamp (DateTime)
> -------------------------------------------------------------
> 12                           |             17.01.2012 16:15:00
> 12                           |             17.01.2012 17:15:00
>
> Now we make a query where the data should involved:
>
> SELECT Id, TimeStamp FROM tabelA
> WHERE Timestamp >= '2012-01-17T00:00:00' AND
> Timestamp <= '2012-01-17T23:59:59' AND
> ID = 12
> ORDER BY Timestamp DESC LIMIT 250 OFFSET 0
>
> Result is 'nothing' means no rows are returned.
>

SQLite does not have a separate "date/time" datatype.  It uses either
strings (preferably in ISO8601 format) or numbers (seconds since 1970 or
Julian day number).

Your WHERE clause is comparing strings, not dates.  If you using ISO8601
dates in your database file, as you do in the query, it will probably work,
though.



>
> But if we change the minimum timestamp to 1 day earlier, like:
>
> SELECT Id, TimeStamp FROM tabelA
> WHERE Timestamp >= '2012-01-16T00:00:00' AND
> Timestamp <= '2012-01-17T23:59:59' AND
> ID = 12
> ORDER BY Timestamp DESC LIMIT 250 OFFSET 0
>
> The result is the 2 rows written above.
>
> ??? I don't get it ???
> Why this is happen, is it really a bug?
>
>
> Regards
>
> Steffen Mangold
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to