dusteater
09-22-2000, 03:31 PM
I have two tables the first one (Products) is a master list of products indexed by ProdId the second table(Loc1) is a list of products used by a location and only lists the ProdId. I want to sum the TotCost field of Loc1 but to break it down by criteria stored in Products (the criteria field is Category) I used tested the query and it works but I don't know how to access each part of the sum. ie. there are the folowing Categories...Meats, Produce, Other.
Here is my SQL Statement, but how do I access the totals for Meats, Produce...etc?
SQLProdSum = "SELECT SUM(Loc1.TotCost), Products.Category" _
& "From Products, Loc1" _
& "Where Products.ProdId = Loc1.ProdId" _
& "GROUP BY Products.Category" _
& "ORDER BY Products.Category"
rsProdSum.Open SQLProdSum, cnCasaFood, adOpenForwardOnly, adLockOptimistic
I know it must be simple but I can't figure it out
Thanks in advance!!
Rick
Here is my SQL Statement, but how do I access the totals for Meats, Produce...etc?
SQLProdSum = "SELECT SUM(Loc1.TotCost), Products.Category" _
& "From Products, Loc1" _
& "Where Products.ProdId = Loc1.ProdId" _
& "GROUP BY Products.Category" _
& "ORDER BY Products.Category"
rsProdSum.Open SQLProdSum, cnCasaFood, adOpenForwardOnly, adLockOptimistic
I know it must be simple but I can't figure it out
Thanks in advance!!
Rick