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 hacker_result as (select h.hacker_id, h.name,s.challenge_id, max(s.score) as score
from Hackers h
inner join Submissions s
on h.hacker_id = s.hacker_id
group by s.challenge_id, h.hacker_id, h.name )
SELECT hr.hacker_id, hr.name, SUM(hr.score) AS total_score
FROM hacker_result hr
GROUP BY hr.hacker_id, hr.name
HAVING SUM(CASE WHEN hr.score > 0 THEN 1 ELSE 0 END) > 0
ORDER BY total_score desc, hr.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 →
with hacker_result as (select h.hacker_id, h.name,s.challenge_id, max(s.score) as score from Hackers h inner join Submissions s on h.hacker_id = s.hacker_id group by s.challenge_id, h.hacker_id, h.name ) SELECT hr.hacker_id, hr.name, SUM(hr.score) AS total_score FROM hacker_result hr GROUP BY hr.hacker_id, hr.name HAVING SUM(CASE WHEN hr.score > 0 THEN 1 ELSE 0 END) > 0 ORDER BY total_score desc, hr.hacker_id asc;