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 |
|
kathyc2003
Starting Member
15 Posts |
Posted - 2007-12-17 : 13:30:58
|
| Hello,I have created the following query... and need to getthe total records display for my report. I have triedadding in the count(*) function to my select list, but I geterrors. Any help is appreciated.SELECT A.ParentSubjectName, A.ParentSubject, A.SubjectId, B.CreatedOnFROM dbo.Subject AINNER JOIN dbo.Incident B ON A.SubjectId = B.SubjectIdWHERE A.ParentSubjectName LIKE 'ACDelco Products%'AND (B.CreatedOn >= '2007-01-01' AND B.CreatedOn <= '2007-11-30')AND A.SubjectId IN ( 'C44ADE3E-527B-DC11-8A2D-00170857BDE7', 'F8758E52-527B-DC11-8A2D-00170857BDE7', '7E65F458-527B-DC11-8A2D-00170857BDE7', '7F65F458-527B-DC11-8A2D-00170857BDE7', '2BE35262-527B-DC11-8A2D-00170857BDE7', '2AE35262-527B-DC11-8A2D-00170857BDE7', 'A2002127-527B-DC11-8A2D-00170857BDE7', '41A8A66F-527B-DC11-8A2D-00170857BDE7', 'A3002127-527B-DC11-8A2D-00170857BDE7', 'D6C08B45-527B-DC11-8A2D-00170857BDE7', 'C439FB4B-527B-DC11-8A2D-00170857BDE7')ORDER BY B.CreatedOn[/blue] |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2007-12-17 : 13:44:31
|
| What application runs "your report"? You can count the rows in the report writer. Somehow I suspect "your report" is the sql output directly. If that is the case, one method is to: "select @@rowcount as [total rowcount]" imediately after your select statement.Be One with the OptimizerTG |
 |
|
|
kathyc2003
Starting Member
15 Posts |
Posted - 2007-12-17 : 16:14:09
|
| HiThanks for answering, I am using SRS Reports.I need to display the name of the category once(example PRODUCT_A) then based on a date rangedisplay only the total_count of the numberof rows returned in the resultset.I have tried creating a count(PRODUCT_A) anddisplaying that in the body section and amgetting an error. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-17 : 16:15:28
|
Try count(DISTINCT PRODUCT_A) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|
|
|