Skip to content

Instantly share code, notes, and snippets.

@RaghuDMT
Last active May 23, 2017 11:49
Show Gist options
  • Save RaghuDMT/7f69b9f94ecdb3061d6a449b9596e124 to your computer and use it in GitHub Desktop.
Save RaghuDMT/7f69b9f94ecdb3061d6a449b9596e124 to your computer and use it in GitHub Desktop.
select v.Venue_Name,
sum(case when([Runs_Scored]=4) then 1 else 0 end) Fours,
count(distinct m.Match_Id) Matches,
sum(case when([Runs_Scored]=4) then 1 else 0 end)/count(distinct m.Match_Id) Fours_Per_Match
from [dbo].[Batsman_Scored] b
inner join Match m on b.Match_Id=m.Match_Id
inner join Venue v on v.Venue_Id=m.Venue_Id
group by v.Venue_Name
order by 2 desc
@RaghuDMT
Copy link
Author

RaghuDMT commented May 23, 2017

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment