53.生成全球排行榜

游戏排行榜显示全球排名.

SELECT player.name, 
       player.level, 
       stats.loadtime, 
       SUM(CASE WHEN hist.result = "won" THEN 1 ELSE 0 END) AS wins
FROM jungleville_stats AS stats 
    UNNEST stats.`pvp-hist` AS hist 
JOIN jungleville AS player ON KEYS stats.uuid
GROUP BY player, stats
ORDER BY wins DESC, player.level DESC

结果:

{
  "results": [
    {
      "level": 47,
      "loadtime": 23,
      "name": "Dixon Jude",
      "wins": 3
    },
    {
      "level": 14,
      "loadtime": 13,
      "name": "Rudy Francis",
      "wins": 1
    },
    {
      "level": 8,
      "loadtime": 18,
      "name": "Joe Marconi",
      "wins": 0
    },
    {
      "level": 4,
      "loadtime": 23,
      "name": "Don Pinto",
      "wins": 0
    }
  ]
}

Last updated

Was this helpful?