Top Competitors

  • + 0 comments

    MS SQL Server:

    select sub1.hacker_id, sub1.name 
    from (
    select h.hacker_id, h.name, count(s.hacker_id) as count
    from submissions s
    inner join challenges c on s.challenge_id = c.challenge_id
    inner join difficulty d on c.difficulty_level = d.difficulty_level 
    inner join hackers h on s.hacker_id = h.hacker_id
    where s.score = d.score 
    group by h.hacker_id, h.name
        ) sub1
    where sub1.count > 1
    order by sub1.count desc, sub1.hacker_id asc