我使用以下查询来找出英雄在游戏中获胜的百分比:
SELECT Hero, (COUNT(*) * g.games) AS p
FROM gamestatistics
JOIN (
SELECT 100/COUNT(*) AS games
FROM gamestatistics
) AS g
WHERE PointEarned>0
GROUP BY Hero
ORDER BY p DESC
但这给了我所有游戏的百分比。我想知道
percentage(for Hero)=(Won games by this player)/(Played games by this hero)
代替
百分比(英雄)=(该玩家赢得的游戏)/(所有游戏)
谢谢。