Hello.
Search in the archives at:
http://lists.mysql.com/mysql
BETWEEN is meant among other operators at:
http://dev.mysql.com/doc/mysql/en/using-date.html
But be aware of that when you're using a datetime columns the query:
SELECT a from b WHERE a BETWEEN '2005-01-01' and '2005-01-03';
is equal to the following one:
SELECT a from b
WHERE a BETWEEN '2005-01-01 00:00:00' and '2005-01-03 00:00:00';
And record with a='2005-01-01 19:00:00' won't be included in the result set.
Erfan Shirazi wrote:
> It works fine, no errors and it seems to get correct data but the mysql
> manual and some other books doesn't mention anything about BETWEEN being
> used like this and therefor I'm not completely sure, anybody with any
> experience with my example?
>
> Erfan Shirazi
> Application Developer, Information Technology - Shipco Transport
> Email: eshirazi@stripped
> Phone: +45 39 15 05 63
>
>
>
> Felix Geerinckx wrote:
>
>> On 07/10/2005, Erfan Shirazi wrote:
>>
>>
>>
>>> I have a question about BETWEEN.
>>> Could it be used to look up fields which have a date between to date
>>> fields?
>>>
>>> Ex: '2005-10-07' BETWEEN tEffectivedate AND tExpirationdate
>>>
>>> tEffectivedate and tExpirationdate are DATE types.
>>>
>>
>>
>> What happened when you tried?
>>
>>
>>
>
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@stripped
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com