Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

count of first column Expand / Collapse
Author
Message
Posted Wednesday, March 20, 2013 3:55 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 20, 2013 9:08 AM
Points: 2, Visits: 4
Hi, I have a column with name ID. The ID value is repeated in query and I grouped it using group by.

It is showing correct way in report. At the end of the report I want the count of the ID. But it is showing total number of IDs in query and not the count displayed in the report. How to get the count displayed in the report.

Note: the second and third column have more than one row for single ID in report.
Post #1433106
Posted Wednesday, March 20, 2013 6:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 17, 2014 11:31 AM
Points: 26, Visits: 180
Do you have grouping on the report itself? If you have Row Grouping on the field, this will show the SUM (or whatever aggregate you want) at the bottom of the report.

See this page from Microsoft on Grouping/Totals:

http://msdn.microsoft.com/en-us/library/ms170712.aspx

HTH.

Mike
Post #1433160
Posted Wednesday, March 20, 2013 9:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 20, 2013 9:08 AM
Points: 2, Visits: 4
I resolved it by using CountDistinct ().. Thank you.
Post #1433292
Posted Thursday, March 21, 2013 5:52 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 17, 2014 11:31 AM
Points: 26, Visits: 180
Glad you figured it out. Thanks for letting us know!

Mike
Post #1433741
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse