SQLzoo JOIN tutorial #13
问题 I have been working on the SQLzoo problems but having trouble with the last one in the JOIN tutorial question #13 - List every match with the goals scored by each team as shown. Link: http://sqlzoo.net/wiki/The_JOIN_operation In the sample code they gave, it uses a case. I modified it like this: SELECT game.mdate, game.team1, CASE WHEN goal.teamid=game.team1 THEN 1 ELSE 0 END score1, game.team2, CASE WHEN goal.teamid=game.team2 THEN 1 ELSE 0 END score2 FROM game, goal WHERE game.id=goal