Parameters are not allowing totals by product

  • Thread starter Thread starter Rose
  • Start date Start date
R

Rose

Couldn't think of a better title...

I have several queries that pull in item ID, description,
quantity, price, plus (hidden) company, month and year.
Month and year are parameters the user inputs, works fine.
But I have to include the company because each query wants
to see a different set of customers, and there is no field
currently to distinguish what set they go in...I'm just
putting the right companies in my criteria.
When I sum the quantity and price, it sums by item ID *by
company*. I want to sum just by item ID for all companies
that are in my company criteria.

How do I force the query to not include the company when
totalling?
 
Hi,


Remove the GROUP BY clause. When there is no GROUP BY clause, the
aggregations occur over all the records (that pass the WHERE clause with
success).



SELECT SUM(amount)
FROM myTable
WHERE companyID IN(1, 2, 333)



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top