Hello! Suppose we have this table..
CREATE TABLE `appointments` (
`idappointments` int(11) NOT NULL AUTO_INCREMENT,
`timeStart` time DEFAULT NULL,
`timeEnd` time DEFAULT NULL,
PRIMARY KEY (`idappointments`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8$$
assumption
Suppose that a range between timeStart and timeEnd cant exist again... I mean that if we intersect all the ranges in the table the result would be EMPTY ,0 , null.An appointment cant cooexist with another..
So what i want to do is a time suggestion if the desired time is occupied... A proposal before and a proposal after the desired time....
So i was wondering instead of writing code to do this if i could write an SQL query to find the nearest empty ranges......
Ex.. timeStart - NEAREST_TO_TIMESTART_TIMEEND >'10 minutes' whereas 10 minutes the duration