首页 新闻 会员 周边

mysql 排名问题

0
悬赏园豆:20 [已解决问题] 解决于 2013-10-09 08:57
分享一个mysql 问题。如何统计某个人做的所有试卷在记录中的排名?
表如下:
想要的结果:
BeginMan的主页 BeginMan | 初学一级 | 园豆:34
提问于:2013-10-08 17:52
< >
分享
最佳答案
-1

有点难,难的是并列排名的情况。

收获园豆:20
angelshelter | 大侠五级 |园豆:9887 | 2013-10-08 20:20


select A.name,(select count(*) from B where score > (select score from B where user="xx" and p_id=A.id) and p_id = A.id) from A

angelshelter | 园豆:9887 (大侠五级) | 2013-10-08 20:29

@angelshelter: 谢谢,但结果还是有些出入的。

BeginMan | 园豆:34 (初学一级) | 2013-10-09 08:28

@BeginMan: 知道啦 > 应该改成>= 

你真厉害,谢谢啦。

BeginMan | 园豆:34 (初学一级) | 2013-10-09 08:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册