On 17 March 2010 11:08, Igor Tandetnik <itandet...@mvps.org> wrote:
> Mike Martin wrote:
>> I am getting occasional incorrect results using between operator
>>
>> example
>>
>> table structure
>> recordings
>> ID
>> tsid
>> start
>> end
>>
>> sample time= 2010-03-16 23:06:00
>> sample start= 2010-03-16-22:00:00
>> sample end= 2010-03-16 23:05:00
>
> Do you actually have a dash between date and time portion in your data (in 
> your example, one appears in start but not in time or end)? If you have it 
> inconsistently, that would throw off any comparisons.
>

no dash, just a typo

>> select tsid from recordings where '2010-03-16 23:05:00' between start and 
>> end'
>
> You have an extra, mismatched single quote at the end.
>
typo

>> This query should return nothing, so can anyone explain why it is
>> recording the tsid
>
> Why should this query return nothing? BETWEEN operator is inclusive. "x 
> between a and b" is equivalent to "x>=a and x<=b".
> --
> Igor Tandetnik
>

It should return nothing because the time 2010-03-16 23:06:00 is later
than the end time of 2010-03-16 23:05:00

This works most of the time but like the above sometimes doesn't
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to