Totals in query

  • Thread starter Thread starter Jerry Stoner
  • Start date Start date
J

Jerry Stoner

Guest
I usually do totals in reports or forms however this time I must output to ecxel for charting. Here's the scenario:
qrySearchAll is RS for a query by form - From that I generate qryFind which is the filtered result from the qbf. I then generate qryScrapRep which further filters data from qryFind and is RS for a Report. From this query I need to generate qryScrapChart which will be outputted to excell. That all works. The problem is I do not know how to sum in a query the following:

Defect Code Qty
CA 5
CA 4
DF 10
DF 5
I need it to sum for CA (Qty 9)
And DF(Qty 15)

Probably very simple but I've never done it in a query.
Thanks in advance for any help.
Jerry
 
this should work, assuming your table name is Defect
Code:
SELECT
  Code
, Sum(Qty) AS SumOfQty
FROM Defect
GROUP BY Code
ORDER BY Code
 

Users who are viewing this thread

Back
Top Bottom