August 31, 2010 at 1:01 pm
After doing all the joins my final result set is something like this
This has records description, count column
Rerecords Description Count
Bank Records 50
Hospital Records 100
I need one more column where the total records which is the sum of bank records and hospital records ie here 150.
Rerecords Description Count
Bank Records 50
Hospital Records 100
Total Records 150
Can any one help me with this?
Thanks
August 31, 2010 at 1:24 pm
It's a little confusing... In your verbal description you're talking about a new colum but your example shows a new row. :ermm:
If you need a new column, you could use SUM() OVER() and for the new row you might want to look for "ROLLUP" in BOL (BooksOnLine, the SQL Server help system, usually installed together with SQL Server).
If none of the above will work you could use UNION ALL as a last resort.
For further explanation (including a coded example based on your scenario) please provide table def for all related tables including sample data in a ready to use format as described in the first link in my signature. Also, please provide your expected result based on the sample data provided together with what you've tried so far.
August 31, 2010 at 1:32 pm
August 31, 2010 at 2:45 pm
Thanks for reply.
i need to have one more added to my query that i need to use as column in ssrs report.
basically i need to have one more row with that total count.
thanks
August 31, 2010 at 2:45 pm
thanks ,
i will see into it.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply