Query Confusion -- Please help
From: JasonCook (anonymous_at_discussions.microsoft.com)
Date: 03/24/04
- Next message: Steve Kass: "Re: maximum prefixes"
- Previous message: Dave Ruhl: "ODBC Connection"
- Next in thread: Vishal Parkar: "Re: Query Confusion -- Please help"
- Reply: Vishal Parkar: "Re: Query Confusion -- Please help"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 07:56:06 -0800
I have three categories (cat1, cat2, cat3) that are updated each month at different times.
Cat1 may have multiple entries for the month.
I need monthly totals for each category and a monthly grand total for all categories.
Here is my problem. We have to start with a certain balance and continue from there. The balance for the end of January is the beginning value for February.
SELECT Sum(Transactions.cat1) AS SumOfcat1, Sum(Transactions.cat3) AS SumOfcat3, Sum(Transactions.cat2) AS SumOfcat2, Transactions.monthID, (sumofcat1+sumofcat2+sumofcat3) AS MonthlyTotal
FROM Transactions
GROUP BY Transactions.monthID
ORDER BY Transactions.monthID;
The above query returns the following
SumofCat1 SumofCat2 SumofCat3 MonthID MonthlyTotal
--------- --------- --------- ------- ------------
90 0 50 1 140
58 9 108 2 175
50 100 100 3 250
I need another field called GrandTotal that shows as follows
GrandTotal
----------
140
315
575
Please help. I looked at the http://www.databasejournal.com/features/mssql/article.php/3112381 site with the grand total tutorial, but can't get it to work in access.
- Next message: Steve Kass: "Re: maximum prefixes"
- Previous message: Dave Ruhl: "ODBC Connection"
- Next in thread: Vishal Parkar: "Re: Query Confusion -- Please help"
- Reply: Vishal Parkar: "Re: Query Confusion -- Please help"
- Messages sorted by: [ date ] [ thread ]