Solved

SQL Query Help - Something like Pivot

Posted on 2011-03-17
3
271 Views
Last Modified: 2012-05-11
Team,

Need your help.

I have a table with some data on it. Please find attached a sample look of the table.

 Sample File
What i really want to do is, %  of escalated cases by team.

Escalation % per team =  Number of Escalations for the day / Number of cases handled for the day.

I cannot run pivot queries in my SQL as it doesnt support.

requesting your help to find the desired result in a query.

Thanks,
David
0
Comment
Question by:davidi1
  • 2
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35156685
select Team
, count(*) total_cases
, sum(case when Status = 'Escalation' then 1 else 0 end) escalations
, cast( sum(case when Status = 'Escalation' then 1 else 0 end) as decimal(20,2)) /  count(*) perc_esc
from yourtable
group by team
0
 
LVL 2

Author Comment

by:davidi1
ID: 35156877
AngelIII - Thank you.., but am looking for per day per team percentage.., sorry if my question was confusing.
0
 
LVL 2

Author Comment

by:davidi1
ID: 35156901
Perfect. I made the changes with dates. Thanks again for your help
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now