title: Insert distinct data into a new table using select and calculate sums at the same time
body: <p>Using MS SQL I'm trying the following:</p>
  
  <p>I have one table with game data. In this table a player name can occur many times.
  I now want to create a summary table, where every player has a single row.</p>
  
  <p>Using the following statement, I can populate the summary tables "playername" column.</p>
  
  <pre><code>INSERT INTO PLAYER_Summary (Playername)
  SELECT DISTINCT [Playername]  
  FROM ppPLAYER
  </code></pre>
  
  <p>The summary table also has columns for sums of the players results.</p>
  
  <p>How can i populate my summary table so that each name and the correlating sums are in it once.</p>
  
  <p>I need something like:</p>
  
  <pre><code>INSERT INTO PLAYER_Summary
  (Playername, WinWhat )
  SELECT DISTINCT [Playername] FROM ppPLAYER , SUM(WinWhat) FROM ppPLAYER
  </code></pre>
  
  <p>How can I make this work and parse the unique playername with his sum?</p>
  
  <p>Thanks</p>