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)
 Get sum from the count

Author  Topic 

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-07-21 : 02:55:02
How can i get the sum from the count's

My query is as below

Select Count(race_code) as RaceCnt from Tbl_Racevoter Group by First_name,race_code
having race_code in('U','O') and First_Name = 'AARON'

I am getting output as
RaceCnt
300
495

But i want result as
RaceCnt
825

How can i achieve this?

G. Satish

Mangal Pardeshi
Posting Yak Master

110 Posts

Posted - 2009-07-21 : 03:10:01
Select Count(race_code) as RaceCnt
from Tbl_Racevoter
WHERE race_code in('U','O') and First_Name = 'AARON'


Mangal Pardeshi
http://mangalpardeshi.blogspot.com
Go to Top of Page

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-07-21 : 03:39:16
Its perfect....Thank you.

quote:
Originally posted by Mangal Pardeshi

Select Count(race_code) as RaceCnt
from Tbl_Racevoter
WHERE race_code in('U','O') and First_Name = 'AARON'


Mangal Pardeshi
http://mangalpardeshi.blogspot.com



G. Satish
Go to Top of Page
   

- Advertisement -