Solved

SQL Query Help - Something like Pivot

Posted on 2011-03-17
3
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

696 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