Contest Leaderboard

  • + 0 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