Hi SQL gurus,

Need little help with ranking query. I have a table which have user submissions saved. Table with data:
Code:
vid	sid	fid	vtime
1	1	23	123123
2	1	21	342141
3	1	32	123132
4	2	23	342424
5	2	44	523421
6	2	33	312313
7	2	64	231231
8	3	23	524141
9	3	21	233123
10	4	09	123123
11	4	52	123131
12	4	83	534535
13	4	49	353453
14	4	19	345355
15	4	79	767464
I can count the rows based on sid by using group by with order by if i need it, and is quite fine till here. But from here i need to rank them based on the count. For example:
Code:
sid	count	rank
1	3	3
2	4	2
3	2	4
4	6	1
I can do it in PHP, but that will require extra piece of code to be written, which i am hopefull can be done via sql query.

Any help will be greatly appreciated.
Thanks