SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Calls Handled Ratio
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sergeant_time
Yak Posting Veteran

68 Posts

Posted - 06/22/2012 :  09:12:53  Show Profile  Reply with Quote
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

India
48076 Posts

Posted - 06/22/2012 :  22:52:30  Show Profile  Reply with Quote

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))


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

Go to Top of Page

sergeant_time
Yak Posting Veteran

68 Posts

Posted - 07/09/2012 :  13:59:34  Show Profile  Reply with Quote
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

68 Posts

Posted - 07/09/2012 :  14:24:15  Show Profile  Reply with Quote
visakh16,

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

visakh16
Very Important crosS Applying yaK Herder

India
48076 Posts

Posted - 07/09/2012 :  16:16:25  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000