Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: open
I have a table which contains:
An event e.g. A Circus
datefrom e.g. 2007-03-01
dateto e.g. 2007-05-31
If I want to call events by month e.g. April datefrom / dateto I have problems with:
SELECT * FROM table WHERE datefrom>='2007-04-01' OR dateto<='2007-04-30';
Nothing is selected because 04/April is BETWEEN the datefrom and dateto.
How would I rewrite the query using BETWEEN?
Many thanks W.
I think that the trick here is to SELECT APRIL/04 events without using APRIL/04 in the code. For example, if a different event(let's say a widget exhibition) ran from 2007-01-01 until 2007-08-31 it would be available in APRIL/04 as well as the reamining seven months.
So the winner is . . . .Lifeinasia.
Thanks again to everyone. The thinking behind your suggestions has been an inspiration.