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.
SELECT H.hacker_id, H.name, SUM(MaximunScore.max_score) AS total_score
FROM Hackers H
INNER JOIN(
SELECT S.hacker_id, S.Challenge_id, MAX(S.score) AS max_score
FROM Submissions S
GROUP BY S.hacker_id, S.Challenge_id) AS MaximunScore
ON H.hacker_id = MaximunScore.hacker_id
GROUP BY H.hacker_id, H.name
HAVING total_score > 0
ORDER BY total_score 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, SUM(MaximunScore.max_score) AS total_score FROM Hackers H
INNER JOIN( SELECT S.hacker_id, S.Challenge_id, MAX(S.score) AS max_score FROM Submissions S GROUP BY S.hacker_id, S.Challenge_id) AS MaximunScore ON H.hacker_id = MaximunScore.hacker_id
GROUP BY H.hacker_id, H.name HAVING total_score > 0 ORDER BY total_score DESC, H.hacker_id ASC;