title: SQL sum field when column values match
body: <p>The title was hard to word but the question is pretty simple. I searched all over here and could not find something for my specific issue so here it is. I'm usuing Microsoft SQL Server Management Studio 2010.</p>
  
  <p>Table Currently looks like this</p>
  
  <pre><code>  | Value | Product Name|
    |  300  | Bike        |
    |  400  | Bike        |
    |  300  | Car         |
    |  300  | Car         |
  </code></pre>
  
  <p>I need the table to show me the sum of Values where Product Name matches - like this</p>
  
  <pre><code>  | TOTAL | ProductName |
    |  700  | Bike        |
    |  600  | Car         |
  </code></pre>
  
  <p>I've tried a simple</p>
  
  <pre><code> SELECT
        SUM(Value) AS 'Total'
        ,ProductName
   FROM TableX
  </code></pre>
  
  <p>But the above doesn't work. I end up getting the sum of all values in the column. How can I sum based on the product name matching?</p>
  
  <p>Thanks!</p>