Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Trini
Starting Member
9 Posts |
Posted - 2006-06-09 : 12:34:58
|
| I need to total filtered values each time the filter criteria changes.So lets say I change the month to JAN then in addition to the subtotals for each category I need to get a Grand Total.Thanks much.SELECT Location, SUM(month_est) AS SubTot_Month_Est, SUM(actual) AS SubTot_Actual, mnth, yrFROM dbo.meetingsGROUP BY Location, mnth, yr |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-06-09 : 14:28:27
|
You didn't really explain what you wanted, but maybe this might be close to what you want.If it isn't, post your table structure, some smaple data, and what you want your output to look like.SELECT Location, yr, mnth, SUM(month_est) AS SubTot_Month_Est, SUM(actual) AS SubTot_ActualFROM dbo.meetingsGROUP BY Location, yr, mnth with rolluporder by Location, yr, mnth CODO ERGO SUM |
 |
|
|
Trini
Starting Member
9 Posts |
Posted - 2006-06-09 : 14:41:46
|
This works fine.Thanks.quote: Originally posted by Michael Valentine Jones You didn't really explain what you wanted, but maybe this might be close to what you want.If it isn't, post your table structure, some smaple data, and what you want your output to look like.SELECT Location, yr, mnth, SUM(month_est) AS SubTot_Month_Est, SUM(actual) AS SubTot_ActualFROM dbo.meetingsGROUP BY Location, yr, mnth with rolluporder by Location, yr, mnth CODO ERGO SUM
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-10 : 03:23:38
|
| If you use Reports, then make use of its aggregate functionMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|