Contest Leaderboard

  • + 0 comments

    SELECT h.hacker_id, h.name, SUM(max_score) AS total_score FROM hackers h JOIN ( SELECT hacker_id, challenge_id, MAX(score) AS max_score FROM submissions GROUP BY hacker_id, challenge_id
    ) best_scores ON h.hacker_id = best_scores.hacker_id GROUP BY h.name, h.hacker_id HAVING SUM(max_score) > 0 ORDER BY total_score DESC, hacker_id ASC