harsha547
4/8/2017 - 9:01 PM

Before Today , there were only one instance of six bowlers picking up a wicket for Royal Challenger's Bangalore.

Before Today , there were only one instance of six bowlers picking up a wicket for Royal Challenger's Bangalore.

-- Before Today , there were only one instance of six bowlers picking up a wicket for Royal Challenger's Bangalore.

-- ie., Against Pune_warriors

WITH Data ( Match , Batting_Team ,Player_Name , Wickets_Taken ) 
As
(    SELECT A.Match_Id , D.Team_Name , C.Player_Name , COUNT(*) As 'Wickets_Taken'
	 FROM Ball_by_Ball A
	 INNER JOIN Wicket_Taken B
	 ON CONCAT(A.Match_Id,A.Over_Id,A.Ball_Id,A.Innings_No)
						= CONCAT(B.Match_Id,B.Over_Id,B.Ball_Id,B.Innings_No)
	 INNER JOIN Player C
	 ON A.Bowler = C.Player_Id
	 INNER JOIN Team D
	 ON A.Team_Batting = D.Team_Id
	 WHERE Team_Bowling = 2 AND B.Kind_Out IN (1,2,4,6,7,8)
	 GROUP BY A.Match_Id , D.Team_Name ,C.Player_Name
)

SELECT Match , Batting_Team ,COUNT(*) As'Bowler_Contribution'
		FROM Data
		GROUP BY Match , Batting_Team
		HAVING COUNT(*) >= 6
		ORDER BY Bowler_Contribution DESC;