We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
WITH max_score_per_challenge AS (
SELECT hacker_id, challenge_id, MAX(score) AS maxscore
FROM submissions
GROUP BY hacker_id, challenge_id
),
total_score AS (
SELECT hacker_id, SUM(maxscore) AS sumscore
FROM max_score_per_challenge
GROUP BY hacker_id
)
SELECT h.hacker_id, h.name, t.sumscore FROM Hackers as h
JOIN total_score as t ON h.hacker_id = t.hacker_id WHERE t.sumscore > 0
ORDER BY t.sumscore DESC, h.hacker_id ASC
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Contest Leaderboard
You are viewing a single comment's thread. Return to all comments →
SELECT h.hacker_id, h.name, t.sumscore FROM Hackers as h JOIN total_score as t ON h.hacker_id = t.hacker_id WHERE t.sumscore > 0 ORDER BY t.sumscore DESC, h.hacker_id ASC