Posted by Hilarion on 12/05/05 13:09
>> Hello.
>> My name is Diego.
>> At first, let me say: * I'm trying write in english. =) *
>>
>>
>> I'm trying to learn php+mysql, but I am stuck in a sentence..
>>
>> I've :
>>
>> idBirth - autonumeric
>> date - date (YYYY-MM-DD)
>> timestart - time (00:00:00)
>> timeend - time (00:00:00)
>>
>> idBirth is that I use to relation with another tables.
>>
>> My trouble is: I don't know how to select a value between 2 dates. (i.e.
>> 2005-12-04 and 2005-1-15).
>
> Should be something like (assuming that date column is of the type DATE):
> SELECT * FROM <table_name> WHERE date <= '2005-12-04' AND date >= '2005-1-15'
Why not use "BETWEEN" operator? It's just the situation it's for:
SELECT *
FROM <table_name>
WHERE (date BETWEEN '2005-01-15' AND '2005-12-04')
Hilarion
Navigation:
[Reply to this message]
|