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 TMP as
(Select hacker_id,challenge_id,max(score) as total_score from Submissions group by hacker_id, challenge_id )
Select TMP.hacker_id, H.name, Sum(TMP.total_score) as sum_score from TMP join Hackers H on TMP.hacker_id = H.hacker_id where total_score!=0 group by TMP.hacker_id, H.name ORDER BY sum_score DESC , Tmp.hacker_id ASC
I got the results with the above query. Can someone help optimize this query
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 TMP as (Select hacker_id,challenge_id,max(score) as total_score from Submissions group by hacker_id, challenge_id ) Select TMP.hacker_id, H.name, Sum(TMP.total_score) as sum_score from TMP join Hackers H on TMP.hacker_id = H.hacker_id where total_score!=0 group by TMP.hacker_id, H.name ORDER BY sum_score DESC , Tmp.hacker_id ASC
I got the results with the above query. Can someone help optimize this query