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 temp as (
select distinct h.hacker_id as hacker_id, name, challenge_id
, max(score) over (partition by h.hacker_id, challenge_id) as max_score
from hackers h
join submissions s on s.hacker_id = h.hacker_id
)
select distinct hacker_id, name, sum(max_score) as total_score
from temp
group by hacker_id, name
having sum(max_score) <> 0
order by total_score desc, 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 temp as ( select distinct h.hacker_id as hacker_id, name, challenge_id , max(score) over (partition by h.hacker_id, challenge_id) as max_score from hackers h join submissions s on s.hacker_id = h.hacker_id )
select distinct hacker_id, name, sum(max_score) as total_score from temp group by hacker_id, name having sum(max_score) <> 0 order by total_score desc, hacker_id asc