Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all,
I have a set of employees and a set of time slots .
An employee can be allocated to any timeslots .What I need is that, if an Employee is allocated in time slots 8:00Am-12:00PM then that Employee should not be available in 08:00AM-10:00AM and 10:00AM-12:00PM slots .Similarly , if the an employee is allocated in 04:00PM-06:00PM then that employee should not be available in any of the timeslots between 04:00PM-06:00PM , but can be available before and after time slots , not in between .
How to do this .Any help will be really appreciated.Thanks in advance.

What I have tried:

Employees

EMP1
EMP2
EMP3
EMP4
EMP5  

Time Slots

08:00AM-10:00AM
10:00AM-12:00PM
04:00PM-06:00PM
08:00AM-12:00PM
02:00PM-06:00PM
08:00AM-04:00PM
09:00AM-01:00PM
08:30AM-01:30PM
12:00PM-04:00PM
2:00PM-3:00PM
Posted
Updated 22-Jul-18 18:54pm
Comments
[no name] 23-Jul-18 4:07am    
Why don't you "order" your time slots by start and end times so they can be discussed intelligently. The answer may then even be obvious.
Richard Deeming 23-Jul-18 12:25pm    
Show the structure of your tables, including the data types. You currently haven't shown us how an employee as allocated to a time slot.

And I hope those time slots are stored as two time columns, not a combined varchar column!
Member 12926744 24-Jul-18 6:28am    
Time columns is stored as two time columns

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900