Hi
I'm trying to generate a report for our call logger, it has a field called Duration that holds the length of time a call took.
I'd like to be able to create a report that shows a Summary of calls to international destinations and the total number of calls and total length of those calls. I have the first part, the total number of calls, but I can't get the total length to work, this is what I have so far: (It's on SQL 2008 Express)
The problem is the field is showing HH:MM:SS yet some of the fields are longer than 24 hours so it's not showing the full information. Is there anyway to format the field as hhh:mm:ss?
or is there a better way of doing this?
I'm trying to generate a report for our call logger, it has a field called Duration that holds the length of time a call took.
I'd like to be able to create a report that shows a Summary of calls to international destinations and the total number of calls and total length of those calls. I have the first part, the total number of calls, but I can't get the total length to work, this is what I have so far: (It's on SQL 2008 Express)
SQL:
SELECT TOP 100
Calls.DigitsDialled,
DiallingCodes.Details as "Location",
DiallingCodes.Code,
count(Calls.DigitsDialled) as "No of Calls",
[COLOR=#F57900]convert(varchar(20), dateadd(second, Sum(DATEDIFF(S,'00:00:00',Duration)), 0), 108) as "Total Length"[/color]
FROM Calls
LEFT JOIN DiallingCodes ON Calls.DigitsDialled LIKE DiallingCodes.Code + '%'
WHERE Calls.DigitsDialled Like '00%'
AND (DATEPART(Month,Calls.LogDate) = 12 AND DATEPART(YEAR,Calls.LogDate) = 2013)
Group BY Calls.DigitsDialled,DiallingCodes.Details,DiallingCodes.Code
ORDER BY "No of Calls" DESC
The problem is the field is showing HH:MM:SS yet some of the fields are longer than 24 hours so it's not showing the full information. Is there anyway to format the field as hhh:mm:ss?
or is there a better way of doing this?