title: Problem with GROUP BY statement (SQL)
body: <p>I have a table GAMES with this information:</p>
  
  <pre><code>Id_Game  Id_Player1  Id_Player2  Week
  --------------------------------------
  1211     Peter       John        2
  1215     John        Louis       13
  1216     Louis       Peter       17
  </code></pre>
  
  <p>I would like to get a list of the last week when each player has played, and the number of games, which should be this:</p>
  
  <pre><code>Id_Player  Week  numberGames
  -----------------------------
  Peter      17    2
  John       13    2
  Louis      17    2
  </code></pre>
  
  <p>But instead I get this one <strong>(notice on Peter week)</strong>:</p>
  
  <pre><code>Id_Player  Week  numberGames
  -----------------------------
  Peter      2     2
  John       13    2
  Louis      17    2
  </code></pre>
  
  <p>What I do is this:</p>
  
  <pre><code>  SELECT Id_Player, 
           MAX(Week) AS Week, 
           COUNT(*) as numberGames 
      FROM ((SELECT Id_Player1 as Id_Player, Week 
               FROM Games) 
             UNION ALL
             (SELECT Id_Player2 as Id_Player, Week 
                FROM Games)) AS g2 
  GROUP BY Id_Player;
  </code></pre>
  
  <p>Could anyone help me to find the mistake?</p>