I got this SELECT, it shows result of match, but it count Goals even if Goal = 0. How can I define to count only where goals is equal to 1?
SELECT
B1.Name AS HomeTeam, ISNULL(C1.Goal, 0) AS HomeTeamScore,
ISNULL(C2.Goal, 0) AS AwayTeamScore, B2.Name AS AwayTeam
FROM
Match A
INNER JOIN
Team AS B1 ON A.HomeTeamId = B1.TeamId
INNER JOIN
Team AS B2 ON A.AwayTeamId = B2.TeamId
LEFT JOIN
(SELECT MatchId, TeamId, COUNT(Goal) AS Goal
FROM PlayerMatch
INNER JOIN Players ON Players.PlayerId = PlayerMatch.PlayerId
GROUP BY MatchId, TeamId) C1 ON A.MatchId = C1.MatchId AND A.HomeTeamId = C1.TeamId
LEFT JOIN
(SELECT MatchId, TeamId, COUNT(Goal) AS Goal
FROM PlayerMatch
INNER JOIN Players ON Players.PlayerId = PlayerMatch.PlayerId
GROUP BY MatchId, TeamId) C2 ON A.MatchId = C2.MatchId AND A.AwayTeamId = C2.TeamId