Date range advanced count calculation in TSQL
- by cihata87
I am working on call center project and I have to calculate the call arrivals at the same time between specific time ranges.
I have to write a procedure which has parameters StartTime, EndTime and Interval
For Example:
Start Time: 11:00
End Time: 12:00
Interval: 20 minutes
so program should divide the 1-hour time range into 3 parts and each part should count the arrivals which started and finished in this range OR arrivals which started and haven't finished yet
Should be like this:
11:00 - 11:20 15 calls at the same time(TimePeaks)
11:20 - 11:40 21 calls ...
11:40 - 12:00 8 calls ...
Any suggestions how to calculate them?