Good morning, folks, I'm going around with a query that would seem simple but I can not find it back. I am developing a reservation system in which fractional every 00:30 minutes and reserve by rank of 01:00:00 or 01:30:00 I have a reservation table id, date, time, status with all possible hours with a state 0 for free and 1 for reserved. The issue is that if I have an example reserve from 10:00:00 to 11:00 and one from 12:00:00 to 13:00:00 and I want to do one from 11:30 to 13:30, he brings it to me as if it was correct being part of that range reserved. Well I hope you understand if you can give me a hand I'll thank you very much
and I have the following query
SELECT *, ADDTIME('hora', '01:00:00') as hasta
FROM 'reservas'
WHERE ('hora' BETWEEN hora and ADDTIME('hora', '01:00:00'))
AND 'dia' = '2017-11-29'
AND 'estado' = '1'