MySQL Forums
Forum List  »  Chinese

Re: URGENT!!! Problem about rank (排序)in mysql server
Posted by: Hu Hailin
Date: March 06, 2007 12:51AM

如果不考虑计算效率,那么可以这么查询,不实际添加列

SELECT r1.name, r1.score, count(if(r2.score > r1.score, TRUE, NULL)) + 1
FROM rank r1, rank r2
GROUP BY r1.id

重视效率的话,要实时排名就比较困难了,一般采取定时刷新排名的方法。

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: URGENT!!! Problem about rank (排序)in mysql server
7243
March 06, 2007 12:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.