I want to query times in my database, but i'm stuck. So for example I have details of a meeting which:
Starts: 2010-12-21 09:00:00
Ends: 2010-12-21 10:00:00
Saved into my database.
So what I want to do is run a query which checks a SET half an hour time period which is between ' 2010-12-21 09:00:00' and ' 2010-12-21 09:30:00' which the above period falls into, but i'm pretty stuck as the query i'm working on below won't work as the ending period is at 10am, even though 9.30 is between 9 and 10?:
SELECT * FROM `TBL` WHERE start_time >= '2010-12-21 09:00:00' AND ends <= '2010-12-21 09:30:00' AND user_id = 3
Anyone kindly help?