• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

SQL Query Help - Something like Pivot

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
davidi1
Asked:
davidi1
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
davidi1Author Commented:
AngelIII - Thank you.., but am looking for per day per team percentage.., sorry if my question was confusing.
0
 
davidi1Author Commented:
Perfect. I made the changes with dates. Thanks again for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now