From 27c793b50400e835f70f151b36f9ae3e09e8beb2 Mon Sep 17 00:00:00 2001 From: Mitul Panchal Date: Fri, 19 Jan 2018 18:15:58 +0530 Subject: [PATCH] Group By problem Group by query fire with multiple column --- 06_the_join_operation.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/06_the_join_operation.sql b/06_the_join_operation.sql index fa1cde1..184b84e 100644 --- a/06_the_join_operation.sql +++ b/06_the_join_operation.sql @@ -72,11 +72,12 @@ GROUP BY goal.matchid -- 12. For every match where 'GER' scored, show matchid, match date and the -- number of goals scored by 'GER' -SELECT matchid, mdate, COUNT(player) + +SELECT matchid,mdate,COUNT(player) FROM game -JOIN goal ON game.id = goal.matchid -WHERE teamid = 'GER' -GROUP BY game.id +JOIN goal ON goal.matchid = game.id +WHERE (team1 = 'POL' OR team2 = 'POL') +GROUP BY goal.matchid,mdate -- 13. List every match with the goals scored by each team as shown. -- Sort your result by mdate, matchid, team1 and team2.