Contest Leaderboard

  • + 0 comments

    SELECT h1.hacker_id, h2.name, h1.sumscore

    FROM (

    SELECT 
    
        hacker_id, 
    
        SUM(max_score) AS sumscore
    
    FROM (
    
        SELECT 
    
            hacker_id, 
    
            challenge_id, 
    
            MAX(score) AS max_score
    
        FROM submissions
    
        GROUP BY hacker_id, challenge_id
    

    ) AS max_scores

    GROUP BY hacker_id
    
    HAVING SUM(max_score) > 0
    

    ) AS h1 JOIN hackers AS h2 ON h1.hacker_id = h2.hacker_id order by h1.sumscore DESC, h1.hacker_id ASC;