Click here to Skip to main content
15,896,450 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
categoryid url count
3 url3new 45
1 url1 50
2 url2 55
3 url3 45
4 url4 53
5 url5 97
6 url6 47
1 url1new 50
2 url2new 55
5 url5new 97
4 url4new 53
6 url6nw 47

i got a record when i fired certain qry in sql
now i want further ordering based on top 5-5 groups of distinct categoryid
order by count

so result shoul look like

categoryid url count
5 url5 97
2 url2 55
4 url4 53
1 url1 50
6 url6nw 47
3 url3new 45

5 url5new 97
2 url2new 55
4 url4new 53
1 url1new 50
6 url6 47
3 url3 45

group top distinct 5 category order by count
again same cycle should repeat

many thanks
Posted

1 solution

Hi,

Please Find the query below.

SQL
SELECT TOP 5 FROM CATEGORY ORDER BY COUNT DESC;


Regards,
Raghu
 
Share this answer
 
v2
Comments
Rakesh S S 26-Jun-12 8:08am    
i want ordering of group or slots of 5-5 and then cycle should continue
as given in result
ssd_coolguy 26-Jun-12 9:05am    
hey amol..
and which basis you are going to make slot of 5-5??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900