Sportalcraft Sportalcraft - 5 months ago 13
SQL Question

Sum and distinct in acces SQL

I already made a query that this was it result :

7 | 3
8 | 4
8 | 2
8 | 1
10 | 3
12 | 4
12 | 1
13 | 3


I need new query that take this result and return this :

7 | 3
8 | **7**
10 | 3
12 | **5**
13 | 3


In the left column I need that evry number will appears only once,
and in the right column sum the numbers according to the value in the left column as I showed before.

how to do it?

Answer
SELECT leftField, SUM(rigthField) as rigthField
FROM YourResult
GROUP BY leftField
Comments