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.
Author |
Topic |
bulubuk1976
Starting Member
24 Posts |
Posted - 2008-01-18 : 06:09:13
|
I am trying to get the % of resolved for every calltype based on an input dates. Here is my table:Table: Win4SessionDate Calltype Status---------------------------------------1/2/2008 Email Resolved1/3/2008 Email Unresolved1/4/2008 Connectivity Resolved1/5/2008 Connectivity Unresolved1/6/2008 Connectivity Resolved1/7/2008 General Resolved1/8/2008 General Resolved1/9/2008 General UnresolvedHere's my desired result given the parameter dates 1/2/08 to 1/9/2008:Calltype #Count #Resolved---------------------------------------Email 2 1Connectivity 3 2General 3 1Here's my code:SELECT Calltype, count(Calltype) as #CountFROM dbo.WIN4Where Sessiondate >= '1/2/2008' and Sessiondate <= '1/9/2008'Group by CalltypeThen problem is that I do not know how to count all the RESOLVED with alias #Resolved.I appreciate any help or who could write the code for me.Thanks!Dennis S. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
mdgryn
Starting Member
6 Posts |
Posted - 2008-01-21 : 01:18:50
|
I think this will help you in case it is the desired result SELECT Calltype, count(Calltype) as #Count,case when Resolved=1 then 'Resolved' else 'Unresolved' end FROM dbo.WIN4Where Sessiondate >= '1/2/2008' and Sessiondate <= '1/9/2008'Group by Calltype,Sessiondate,case when Resolved=1 then 'Resolved' else 'Unresolved' end |
 |
|
|
|
|