Sum of Numbers question

  • Thread starter Thread starter Halston
  • Start date Start date
H

Halston

I was trying to find the number of items sold by a specific product ID number
in queries, but i can't figure out how to do it. does anyone have any advice
on how i could achieve a task like this?
 
I was trying to find the number of items sold by a specific product ID number
in queries, but i can't figure out how to do it. does anyone have any advice
on how i could achieve a task like this?

Not without some more information!

Have you tried a Totals query? Create a query based on you table and click the
Greek Sigma icon (looks like a sideways M). You can use the default "Group By"
totals operator to group by product ID and change it to Sum on the field that
you want to sum.

John W. Vinson [MVP]
 
DSUM("quantitySold", "tableNameHere", "productID = 444" )

or, with a query (in SQL view)

SELECT SUM(quantitySold)
FROM tableNameHere
WHERE productID = 444


which will sum the value under the field quantitySold for all the records
having the value 444 under the field productID. You can switch from the SQL
Query view to the Design Query view to see how you could have produce the
same query, graphically.



Hoping it may help,
Vanderghast, Access MVP
 
Assuming you have something similar to an OrderDetails table, you could:

1. Open a new query
2. Select the ProductID, and quantity fields and add them to the query grid
3. Make the query an aggregate query (click on the Sigma symbol - looks
like a M laying on its left side - located in about the middle of the query
toolbar).
4. Change the GroupBy to Sum in the Quantity column, Totals row of the
query grid

Run the query.

HTH
Dale
 
Back
Top