Hi I have a table that records meteor events - each record amongst other things has the date and time. I want to search for an event and specify the date but also the time but i want to have a + or - on the time, i started with this SELECT duration_events.event_id, duration_events.date, duration_events.Time FROM duration_events WHERE duration_events.date = '2020-05-15' and duration_events.Time='05:22:30'; Code (markup): but I want the search bring back events that are + or minus 5 seconds not just events that are at 05:22:30 and as I do lots of search for different events I dont want to use fixed between type statement - hope that makes sense Help appreciated Regards John B
two approaches When you build your sql query inside a PHP/ASP/Java script you can calculate the dates using the date object or SELECT duration_events.event_id, duration_events.date, duration_events.time, FROM duration_events WHERE duration_events.date = '2020-06-02' AND duration_events.time BETWEEN DATE_ADD(CAST('05:10:00' AS TIME), INTERVAL -5 minute) AND DATE_ADD(CAST('05:10:00' AS TIME), INTERVAL 5 minute); Code (markup): I used minutes because it worked with my sample data, you'd just need to change the interval.