Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 General Discussion
»
Column and Row Total
Column and Row Total
Rate Topic
Display Mode
Topic Options
Author
Message
KpSQL123
KpSQL123
Posted Monday, January 18, 2010 6:45 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, June 06, 2012 2:50 AM
Points: 19,
Visits: 47
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
Post #849124
GilaMonster
GilaMonster
Posted Monday, January 18, 2010 7:07 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:18 PM
Points: 38,062,
Visits: 30,359
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 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #849139
LutzM
LutzM
Posted Monday, January 18, 2010 1:08 PM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 12:04 PM
Points: 6,739,
Visits: 12,167
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...)
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #849351
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.