Groups | Blog | Home
all groups > sql server reporting services > august 2006 >

sql server reporting services : using count in a stored procedure


aggiechick717
8/25/2006 12:54:38 PM
I am having some issues with RS. Basically I have a sproc that returns
all of the data I need. I am trying to enchance the sproc to make it
only contain a delivery system(one of my columns) that has only one
meter( another column). Right now it is pulling every delivery system
and meter in my database. I tried using count to count the rows and if
there was a delivery system name repeated not to display it. Anyone
have any ideas what to do next? Should I create another sproc maybe?
Any help would be greatly appreciated!!

Here is the code for the last select statement in my sproc if it helps:



SELECT A.District

, A.FieldOffice

, A.DelSysID

, A.DelSysCode

, A.DelSysName

, A.ZoneID

, HZ.HdrName

, A.GasMeterHID

, HG.HdrName as MeterName

, A.MeterCode

, A.MeterType

, A.MeterAttr

FROM #MetersInDelSys A (TABLOCKX)

INNER JOIN CHK..fbMasHdr HZ (NOLOCK) ON HZ.HdrHID=A.ZoneID

INNER JOIN CHK..fbMasHdr HG (NOLOCK) ON
HG.HdrHID=A.GasMeterHID

INNER JOIN (SELECT DelSysID

, count(*) as num

FROM #MetersInDelSys

GROUP BY DelSysID

HAVING count(*) = 1) G1 ON
G1.DelSysID=A.DelSysID


order by a.district
Amarnath
8/26/2006 1:43:01 AM
If you want a row number or numbering of records in the dataset, use
=RowNumber(Nothing) in your layout.

Amarnath


[quoted text, click to view]
aggiechick717
8/28/2006 8:07:40 AM

I don't exactly need the row number....
I just want to pull the data where the count of the delivery system
name =1. So basically any delivery system that isn't repeated in the
data.
AddThis Social Bookmark Button