Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A view which adds up grouped data

Status
Not open for further replies.

toon10

Programmer
Mar 26, 2004
303
DE
I have an Access project with a table consisting of customers. It’s a detail table so there are multiple line detail records. E.G

Customer Value 1 Value 2 Profit
Smith 10 20 10
Smith 30 50 20
Jones 15 25 10
Franks 30 55 25
Franks 10 10 0
Franks 20 5 -15

I want to write a view that basically tallies up the values for each customer so that the detail for each customer is on 1 line. For example,

Customer Value 1 Value 2 Profit
Smith 40 70 30
Jones 15 25 10
Franks 60 70 10

Any ideas would be appreciated!

Thanks
Andrew
 
Select
Customer,
Sum(Value1) as val1,
Sum(Value2) as val2,
Sum(Profit) as theProfit
From yourtable
Group by Customer
 
As simple as that eh! I was expecting some huge array driven solution! I'll give that a go.

Thanks.
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top