尝试选择您自己氏族以外的其他氏族的玩家总得分,以确定您的氏族排名。

它返回的行数(大于氏族分数)是氏族的位置。如果返回3行,则您的氏族排在第四位。

我的SQL(不起作用):

SELECT sum(score) as sum_score
FROM players WHERE sum_score  > " .$our_clan_score . "
AND clan !=0 AND clan != $our clan
GROUP BY clan


players

id    name    score    clan
------------------------------
4     Bill    455      2

最佳答案

可能是(无法检查)

SELECT sum(score) as sum_score
FROM players WHERE  clan !=0 AND clan !=  ".$our_clan."
GROUP BY clan
HAVING sum_score  > " .$our_clan_score . "

09-08 10:24