SQL distinct and summing

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

SQL distinct and summing

Post by sal21 »

I have in access table a field COD end AMOUNT similar:

cod amount
AAA 1200
AAA 1200
BBB 50
...
CCC 1000

I need for each distinct COD the related summ of AMOUNT

Result:

AAA 2400
BBB 50
...
CCC 1000

How to?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SQL distinct and summing

Post by HansV »

Create a totals query; group by COD and sum by AMOUNT.
Best wishes,
Hans