Why does this query not return records where both fields using CASE WHEN are zero? I'm attempting challenge 13 on this SQLzoo page, but my query returns one fewer row than it's supposed to.  

SELECT mdate,
  team1,
  SUM(CASE WHEN teamid=team1 THEN 1 ELSE 0 END) AS score1,
  team2,
  SUM(CASE WHEN teamid=team2 THEN 1 ELSE 0 END) AS score2
  FROM game JOIN goal ON matchid = id
GROUP BY mdate, matchid, team1, team2


When both SUM values would be zero, the query just doesn't return than record and I've no idea why.
You need to do a LEFT OUTER JOIN on goal to pick up the 0-0 games. 

SELECT mdate, 
  team1,
  sum(CASE WHEN teamid=team1 THEN 1 ELSE 0 END) score1,
team2, 
  sum(CASE WHEN teamid=team2 THEN 1 ELSE 0 END) score2
  FROM game 
LEFT OUTER JOIN goal ON matchid = id
group by mdate, matchid, team1,team2
order by mdate, matchid, team1 ,team2


You were nearly there.