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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need help on COUNT of a column

Author  Topic 

msv
Starting Member

9 Posts

Posted - 2009-05-25 : 10:40:53
I have 2 tables... I need to display the SRID,SRNUM and also the number of records associated to the SRID (like the number of columns returned when you enter an SRID)

SELECT a.SRID as ID,
b.SR_NUM as Number,
count (*) as Total
FROM ACT a
with (nolock)
INNER JOIN SERV b (nolock) on a.SRID = b.SR_ID

Need some help... everytime i run this with the Count it throws me an error... Need some help here

nr
SQLTeam MVY

12543 Posts

Posted - 2009-05-25 : 10:42:38
SELECT a.SRID as ID,
b.SR_NUM as Number,
count (*) as Total
FROM ACT a
with (nolock)
INNER JOIN SERV b (nolock) on a.SRID = b.SR_ID
group by a.SRID , b.SR_NUM

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-25 : 10:43:46
SELECT a.SRID as ID,
b.SR_NUM as Number,
count (*) as Total
FROM ACT a
with (nolock)
INNER JOIN SERV b (nolock) on a.SRID = b.SR_ID
GROUP BY a.SRID, b.SR_NUM


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-25 : 10:44:03



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

msv
Starting Member

9 Posts

Posted - 2009-05-25 : 11:33:30
Thank you so much!!
Go to Top of Page
   

- Advertisement -