I'm confused as to why you would expect any match at all.  And indeed, when I 
run your queries against a test set I get nothing back at all for both queries.



Your datetime formats don't match at all.  And "ORDER BY" for that field is not 
date/time order since you have DD.MM.YYYY which won't result in datetime order. 
 You'll get all 01 days, then 02 days, then 03 days, etc.

Plus...what's the "T" supposed to do?  Perhaps I'm ignorant of the magic you 
expect.



This is what I did

CREATE TABLE tableA(id,Timestamp);
INSERT INTO "tableA" VALUES(12,'17.01.2012 16:15:00');
INSERT INTO "tableA" VALUES(12,'17.01.2012 17:15:00');

SELECT Id, TimeStamp FROM tableA
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;

--no records--





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Steffen Mangold [steffen.mang...@balticsd.de]
Sent: Monday, January 23, 2012 8:29 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] Possible Timestamp Where cluase bug

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.

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

Reply via email to