I have three tables such as employees,Time slots and Scheduling . For example
Time Slots table :
id time
1 08:00:00 10:00:00
2 10:00:00 12:00:00
3 16:00:00 18:00:00
4 08:00:00 16:00:00
5 14:00:00 18:00:00
Employee Table:
EMP1
EMP2
EMP3
EMP4
Scheduling table :
EMP TIMESLOTS ID
EMP1 1
EMP2 2
EMP3 4
I need to show the list of free employees in the time slots in a Gridview, ie since EMP3 is allocated in ( 08:00:00 16:00:00) ,then it should not be shown in any time slots between 08:00:00 16:00:00 ,but can be shown in any timeslot before 08:00:00 and after 16:00:00 ,similarly for all the scheduled Employees . If any of the employees is not scheduled on any time slots ,then that employee should be available in every time slots . ie ,EMP5 should be available in all time slots .
My output should be like this :
EMPLOYEES FREE TIME SLOTS
EMP1 10:00:00 12:00:00
EMP1 14:00:00 18:00:00
EMP1 16:00:00 18:00:00
EMP2 08:00:00 10:00:00
EMP2 16:00:00 18:00:00
EMP2 14:00:00 18:00:00
EMP3 16:00:00 18:00:00
EMP4 08:00:00 10:00:00
EMP4 10:00:00 12:00:00
EMP4 16:00:00 18:00:00
EMP4 08:00:00 16:00:00
EMP4 14:00:00 18:00:00
Any help will really appreaciated.Thanks in advance