Alexey Pechnikov wrote:
> 
> There is problem for select one row by time - we must use query
> select * from events where time || =julianday('2008-06-16 23:59:59.999');
> and index is not used for this query. 
> Maybe patch http://www.sqlite.org/cvstrac/chngview?cn=5215
> resolved problem but I'm not sure.

There is no problem with this except that it is usually unreliable to do 
equality comparisons with floating point data such as julian day numbers.

When you say "select one row by time" do you mean that there can only be 
one row in each millisecond period, or do you really mean that you want 
all the rows within that one millisecond period, or perhaps you only 
want the first row in that millisecond period.

In any case, the secret is to know what your required time resolution 
is, and use a normal range query to select rows using the start and end 
times of that period. For a one millisecond long period you can use:

   select * from events
   where time between julianday('2008-06-16 23:59:59.999')
     and julianday('2008-06-16 23:59:59.999') + 1.0/(86400000)

or

   select * from events
   where time between julianday('2008-06-16 23:59:59.999')
                  and julianday('2008-06-17 00:00:00.000')

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to