The name was difficult to formulate, but the question is quite simple. I was looking for everything here and could not find something for my specific problem, so here it is. I am using Microsoft SQL Server Management Studio 2010.
The table currently looks like this
| Value | Product Name| | 300 | Bike | | 400 | Bike | | 300 | Car | | 300 | Car |
I need a table to show me the sum of the values ββin which the product name matches - for example,
| TOTAL | ProductName | | 700 | Bike | | 600 | Car |
I tried simple
SELECT SUM(Value) AS 'Total' ,ProductName FROM TableX
But the above does not work. As a result, I get the sum of all the values ββin the column. How can I summarize based on product name match?
Thanks!
sql sum
Ashton sheets
source share