当前位置:Gxlcms > 数据库问题 > PHP+mysql统计排名第几位

PHP+mysql统计排名第几位

时间:2021-07-01 10:21:17 帮助过:7人阅读

select count(*) + 1 from `table` where rank > (select rank from `table` where id = *)

 

select count(1) from 用户表 where 积分总数>张三的积分数 or (积分总数=张三的积分数 and 用户编号<=张三的用户编号)
 
这也相当于
order by 积分总数 desc,用户编号 asc

 

PHP+mysql统计排名第几位

标签:

人气教程排行