Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Calls Handled Ratio

Author  Topic 

sergeant_time
Yak Posting Veteran

73 Posts

Posted - 2012-06-22 : 09:12:53
I am trying to get the ratio of CH (calls handled) between two Splits(For example; Split 10000 CH/Split 100 CH * 100). I am having a difficult time trying to figure out the query for this. I do have a sample code below.

SELECT split , COUNT(answer_time) AS CH, COUNT(queued_time) AS CO

FROM log

WHERE (queued_time >= DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) - 6, 0)) AND (split IN ('100', '1000')) AND (queued_time < DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0))

GROUP BY split

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-22 : 22:52:30
[code]
SELECT (COUNT(CASE WHEN split ='1000' THEN answer_time ELSE NULL END)/NULLIF(COUNT(CASE WHEN split ='100' THEN answer_time ELSE NULL END),0)) * 100.0
,COUNT(queued_time) AS CO

FROM log

WHERE (queued_time >= DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) - 6, 0))
AND (queued_time < DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0))
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sergeant_time
Yak Posting Veteran

73 Posts

Posted - 2012-07-09 : 13:59:34
visakh16,

I tried your code and I think that I am almost there. How can I convert to decimal?
Go to Top of Page

sergeant_time
Yak Posting Veteran

73 Posts

Posted - 2012-07-09 : 14:24:15
visakh16,

Disreguard! it works fine. Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-09 : 16:16:25
quote:
Originally posted by sergeant_time

visakh16,

Disreguard! it works fine. Thanks


welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -