title: Create array in GROUP BY
body: <p>I am making a golf leaderboard in which I take all the hole scores from a specific matchid and group them by the userid. This part works just fine.</p>
  
  <p>I do so like this:</p>
  
  <pre><code>$playersArray = array();
  
  $sql = "SELECT *, SUM(point) AS points, COUNT(*) AS holes, COUNT(*)*2-SUM(point) AS topar FROM fb_score WHERE matchid=$matchid GROUP BY userid";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
  
      while($row = $result-&gt;fetch_assoc()){
          $playersArray[] = $row;
      }
  
  }
  </code></pre>
  
  <p>Now, my question is, is there a waythat I can create an array of all the "point" for each user and get that into the $row?</p>
  
  <p>Lets say that the SUM(point) is summed by lets say 3 points (3, 5, 4). Can I get this out in the result. As it is now I only get the latest $row for each user, but with the added "points", "holes" and "topar".</p>
  
  <p>Hope this question makes sense :-/</p>
  
  <p>Any help is appreciated and thanks in advance :-)</p>