January 18, 2010 at 6:45 am
I need to calculate row and column totals. I am selecting the report from one view. In that view days are across those dates are getting dynamically.
This view will get updated every day and every day new column(current date as new column) will be added to the report
Please some one suggest me to add the row and column totals for that view.
Thanks
January 18, 2010 at 7:07 am
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 18, 2010 at 1:08 pm
I'd talk to the folks that are responsible for the script that adds the column each day to give me another column [row_total] that would add all previous columns. If they do it using DynamicCrossTab it'll be an easy task for them to do. 😉
To get the column totals use sum() or, if needed together with the row results, look into WITH ROLLUP operator.
If you need more info than that, please read the first link in my signature (it'll link you to the same article Gail has been pointing at...)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply