尝试在您自己以外的战队中选择球员得分的总和,以确定您的战队排名。
它返回的行数(大于你的部族得分)是你的部族位置。如果它返回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
答案 0 :(得分:3)
可能(不能检查)
SELECT sum(score) as sum_score
FROM players WHERE clan !=0 AND clan != ".$our_clan."
GROUP BY clan
HAVING sum_score > " .$our_clan_score . "