Hi I have the following table:
descript | start | end
test 1 | 2011-07-18 14:30:00 | 2011-07-18 17:00:00
test 2 | 2011-07-18 00:00:00 | 2011-07-19 00:00:00
SELECT * FROM event WHERE start >= "2011-07-18 00:00:00" AND end <= "2011-07-18 23:59:59";
The above query is dynamically selected by user. Given this sql query I'd like to also retrieve the 2nd record as the start date falls into 18th July category. How do I do that?
The above select statement obviously can't retrieve the 2nd result as the end date is more than "2011-07-18 23:59:59" but the start date is still in the 18july range. If i use an OR in the statement I get garbage result