Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have fired certain query in sql and i got result as

catid       url  		count

928	   url1	      	        790
928	   url2	    	        790
928        url3         	790
928        url4         	790
928        url5         	790
928        url6         	790
928        url7         	790

4180	   url8	      	        800
4180	   url9	      	        800
4180       url10       	        800
4180       url11	      	800
4180       url12	      	800

2818	   url13	      	810
2818	   url14	      	810
2818       url15      	        810
2818       url16	      	810

4574	   url17       	        820
4574	   url18		820
4574	   url19		820
4574	   url20		820
4574	   url21		820

664	   url22		830
664	   url23		830
664	   url24		830
1898	   url22		830
1898	   url23		830
1898	   url24		830
1898	   url25		830


result cycle should be


1898	   url22		830
4574	   url17        	820
2818	   url13		810
4180	   url8		        800
928	   url1		        790

664	   url23		830
4574	   url18		820
2818	   url14		810
4180	   url9		        800
928	   url2		        790

664	   url24		830
4574	   url19	        820
2818       url15        	810
4180       url10        	800
928        url3         	790

1898	   url22		830
4574	   url20		820
2818       url16		810
4180       url11		800
928        url4         	790

1898	   url23		830
4574	   url21		820
4180       url12		800
928        url5         	790

1898	   url24		830
928        url6         	790

1898	   url25		830
928        url7         	790




how can get such cycle with above ordering

many thanks..

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 29-Jun-12 0:09am
v2
Comments
bhagirathimfs 29-Jun-12 6:43am    
What is common between these url (url22,url17,url13,url8,url1)
Rakesh S S 29-Jun-12 7:14am    
i also try to find the common part
but no luck..

1 solution

i think u want to sorting
like count as descending and then catid as assessing

if yes then try it.

SQL
select * from Table order by count desc,catid asc
 
Share this answer
 
Comments
Rakesh S S 29-Jun-12 7:34am    
see the ordering i want its random order
830
820
810
800
790
830
820
810
800
790
830
820
810
800
790
830
820
810
800
790

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