在mysql中查找整数的排名 [英] Find the ranking of an integer in mysql
本文介绍了在mysql中查找整数的排名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
MySQL排名函数
Possible Duplicate:
Mysql rank function
我有以下国家/地区表
country clicks
------- ------
0 222
66 34
175 1000
45 650
在这种情况下,如何获得国家/地区" 45的排名为2?
How do I get the ranking of say country 45 which is 2 in this case?
推荐答案
您将获得如下所示的2级排名:
You can get 2 rank as below it like below:
Select * from tabeName order by clicks limit 1,1
3级:
Select * from tabeName order by clicks limit 2,1
这篇关于在mysql中查找整数的排名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文