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
 General SQL Server Forums
 New to SQL Server Programming
 Top 3 records

Author  Topic 

Trininole
Yak Posting Veteran

83 Posts

Posted - 2011-04-25 : 09:55:42
what is the syntax for retrieving the top 3 records and the counts of those same top 3 records?

Roger DeFour

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-04-25 : 10:02:08
What determines the TOP 3, the counts?

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

Trininole
Yak Posting Veteran

83 Posts

Posted - 2011-04-25 : 10:04:31
Yes the counts of services determines the top 3

Roger DeFour
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-25 : 10:34:15
select top 3 col, count(*) from table
group by col
order by count(*) desc

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -