I have table name Availableslots. it contains 2 columns
1.WorkerId (int)
2.StartDate (DateTime)
StartDate contains availability of all workers.
Now I need a query that select n number of consucutive slots ... like
WorkerId StartDate
1 31/01/2018 09:00
1 31/01/2018 10:00
2 31/01/2018 09:00
3 31/01/2018 09:00
3 31/01/2018 10:00
4 31/01/2018 09:00
As per this data only worker 1 and 3 has 2 continuous slots available. I am passing these slots as parameter.
I am using MSSQL.
Note:- I am passing time slot as a parameter and that is not fixed. It may vary from 2 to n numbers...