Top Competitors

  • + 0 comments

    Simple Solution

    WITH temp_table AS(
        SELECT a.hacker_id, d.name, a.challenge_id, a.score from submissions as a
        INNER JOIN challenges AS b
        ON a.challenge_id = b.challenge_id
        INNER JOIN difficulty AS c
        on b.difficulty_level = c.difficulty_level
        INNER JOIN hackers as d
        on a.hacker_id = d.hacker_id
        WHERE a.score = c.score
    )
    
    -- Now showing details for all hacker who scored full  
    
    SELECT hacker_id, name FROM temp_table
    GROUP BY name, hacker_id
    HAVING COUNT(score)>1
    ORDER BY COUNT(score) desc, hacker_id asc;