Very true.  I just can not make the time math work any other way.  I guess 
there are kinks in how SQLite handles date comparisons.
 
Bart
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Igor Tandetnik
Sent: Mon 9/21/2009 9:11 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Date comparisons



Barton Torbert wrote:
> Even though this is a bit more complicated, it does seem to work
> correctly.
>
> SELECT t1.realdate1,
>              t2.realdate2
> from test_table_1 t1 left outer join test_table_2 t2 where
>     strftime ('%s', t2.realdate2) between  strftime ('%s',
> datetime(t1.realdate1, '-1 minutes') ) and   strftime ('%s',
> datetime(t1.realdate1, '+1 minutes') )

This would lose any benefit of the index on realdate2, in case you have
one.

Igor Tandetnik



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


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

Reply via email to