【发布时间】:2011-06-02 19:47:17
【问题描述】:
我有表用户,其中包含列:id、name、points、extra_points。 当排名是点数和 extra_points 的总和时,如何获得特定用户的排名?
对于所有用户列表排名 Im 使用此查询:"SELECT id, (points + extra_points) AS total FROM users ORDER BY total desc"; 和带有 html ol 标记的 while 循环(因此有位置编号)。
但我不知道如何显示单个用户的排名(在用户个人资料页面中)?
任何帮助都会很棒。
【问题讨论】:
-
这已经被问过了:Row Rank in a MySQL View