I'm building a report in Crystal Reports using a SQL command against a T-SQL 2005 telephony database.
I need to be able to run the query across a given datetime range, 6 months for example and bring back a 5 day display (Mon-Fri) with a group for every 15 minute interval in each day.
The group figures need to contain an average of the amount of calls presented for each 15 minute interval on any day across the whole datetime range, so for example the Monday 10:00 - 10:15 figure would be an average of all calls presented in every 10:00-10:15
range on each of the Mondays that fall within the datetime range.
I've got a query built now that gives total presented figures grouped by these intervals across one week but I can't figure out how to do this average function across a range.
Does anyone have any idea how I'd go about accomplishing this? I'm pretty new to SQL but keen to learn so any pointers on functions to research etc would be very much appreciated.
Thanks alot in advance, Andy.
Query for detail view across one week included below for table/fields etc...
count(DISTINCT Calls.SessionID) as Presented, min(Calls.startDateTime) as DateTime
INNER JOIN QueueDetail
ON Calls.sessionID = Queues.sessionID
AND Calls.sessionSeqNum = QueueDet
View Complete Post