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 cte as (
select
sub.submission_id as submission_id,
sub.hacker_id as hacker_id,
hack.name as name,
sub.challenge_id as challenge_id,
diff.difficulty_level as difficulty_level,
sub.score as score_gain,
diff.score as total_score
from Submissions sub
left join Hackers hack on hack.hacker_id = sub.hacker_id
left join Challenges chal on chal.challenge_id = sub.challenge_id
left join Difficulty diff on diff.difficulty_level = chal.difficulty_level
)
select hacker_id,name
from cte
where score_gain=total_score
group by hacker_id
having count(challenge_id)>1
order by count(challenge_id) desc,name asc
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Top Competitors
You are viewing a single comment's thread. Return to all comments →
what is wrong in mine?
with cte as ( select sub.submission_id as submission_id, sub.hacker_id as hacker_id, hack.name as name, sub.challenge_id as challenge_id, diff.difficulty_level as difficulty_level, sub.score as score_gain, diff.score as total_score
) select hacker_id,name from cte
where score_gain=total_score group by hacker_id having count(challenge_id)>1 order by count(challenge_id) desc,name asc