Skip to content

Commit 3ebfa70

Browse files
authored
Update team-scores-in-football-tournament.sql
1 parent 6639a71 commit 3ebfa70

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

MySQL/team-scores-in-football-tournament.sql

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ LEFT JOIN
1313
ELSE 0
1414
END AS points
1515
FROM Matches
16-
UNION ALL SELECT guest_team AS team_id,
17-
CASE
18-
WHEN host_goals < guest_goals THEN 3
19-
WHEN host_goals = guest_goals THEN 1
20-
ELSE 0
21-
END AS points
16+
UNION ALL
17+
SELECT guest_team AS team_id,
18+
CASE
19+
WHEN host_goals < guest_goals THEN 3
20+
WHEN host_goals = guest_goals THEN 1
21+
ELSE 0
22+
END AS points
2223
FROM Matches) m
2324
ON t.team_id = m.team_id
2425
GROUP BY t.team_id

0 commit comments

Comments
 (0)