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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing Groups of Data

Status
Not open for further replies.

DLSE

Technical User
Sep 5, 2002
24
US
I am currently designing a fairly simple database. I wish to sum the quantity for a single item that contains multiple entries (each with a distinct date). For example:

Date Item Quantity

4/7/03 Concrete 5
4/16/03 Concrete 2
2/3/03 Backhoe 1
2/5/03 Backhoe 3

I am trying to sum the quantity of each individual item category. When I leave the "Date" field out of the query, only one listing of a single item is seen and the quantities are added (for example, concrete's quantity would show "7". However, when I include the date, each entry is separated. I realize that I would sum each item vertically in a report, but this will not be compatible with future parts of this report.
Thanks you for your help,
Matt Savage
 
Try this

SELECT test.Item, Sum(test.Quantity) AS SumOfQuantity
FROM test
GROUP BY test.Item;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top