Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Oct 5, 2017

Summing a COUNT Aggregate SQL Function

The following code snippet shows a small example of how you can sum the result of a count aggregate function.

select sum(studentcount) as TotalCount
from
(
    SELECT  
        count(s.studentname) as studentcount,
        s.studentname as studentname
    FROM [students] as s  
    group by s.studentname 
    order by count(s.studentname) desc 
)a
Hannes du Preez
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date