I’m really stuck into this situation.
I have these 2 tables:
- employee_working_schedule (stores the start and end time an employee works in a specific date)
- employee_appointments
Let’s suppose we have those rows stored
employee_working_schedule:
start | end
10:00 | 18:00
employee_appointments:
start | end
10:10 | 11:00
11:20 | 12:00
14:30 | 15:20
in this case I want to show that available times are:
10:00 | 10:10
11:00 | 11:20
12:00 | 14:30
15:20 | 18:00
Is there a way of doing this by SQL? I have tried to achieve with php, but no success so far.
Any help will be appreciated.
Here is a way to do it in pure PHP:
OUTPUT