我想问你,如果我在SELECT COUNT(*)
中使用这个ORDER BY是正确的Orginal: SELECT count(*) AS cnt FROM players WHERE totalpoints>?
Modified: SELECT count(*) AS cnt FROM players WHERE totalpoints>? ORDER BY timeontheserver DESC
在原始查询中,它输出给定的玩家" rank"在数据库中。
但我只注意到一些"球员"有相同数量的积分,他们有点逆转。所以它应该给予玩家更高的" timetheserver"更好"排名"。 我希望你能理解这一点,谢谢。
答案 0 :(得分:1)
COUNT(*)会为您提供一个号码,您希望在您订购的字段上进行分组,以获得您想要的内容。
SELECT timeontheserver ,count(*) AS cnt FROM players
WHERE totalpoints>? GROUP BY timeontheserver ORDER BY timeontheserver DESC