1
is the following I am creating an online schedule and need to list the and show the times that are not scheduled, to show the schedules free. And for that I created the schedule_schedules table where in the fixed schedule_hours column is the list of schedules, and in the other table the schedule_schedules is where the schedules are and I need the value that is in the schedule_schedules table in the case in the fixed schedule_hours column, only appear times that have not been scheduled, and the problem that is happening that appears example:
I need the values of a table with fixed times not to appear in select.
The fixed times are: 02:00 02:10 02:20 02:30
Then one person scheduled the time from 02:00 to 02:30, then the time of 02:10, 02:20 are appearing on select and should not.
follow the query I made:
SELECT horariosfixos
FROM agendamento_horarios
WHERE horariosfixos NOT IN(SELECT horaInicio
FROM agendamento
WHERE data = '17-10-2016'
UNION
SELECT horaFim
FROM agendamento
WHERE data = '17-10-2016')
If you can help me, I’m grateful.
When you do a NOT IN search, you are doing an exact search. You are matching the values. In your case, I believe you will need to use the BETWEEN, to search between two values.
– Rick Wolff