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.
- Prepare
- SQL
- Basic Join
- Top Competitors
- Discussions
Top Competitors
Top Competitors
Sort by
recency
|
2299 Discussions
|
Please Login in order to post a comment
SELECT S.hacker_id,H.name FROM Submissions as S LEFT JOIN Challenges as C on C.challenge_id=S.challenge_id LEFT JOIN Difficulty as D on C.difficulty_level=D.difficulty_level LEFT JOIN Hackers as H on H.hacker_id=S.hacker_id Where S.score=D.score Group by S.hacker_id,H.name having Count()>1 Order by Count() desc, S.hacker_id asc
FOR MY SQL: SELECT solver_id, solver_name FROM ( SELECT COUNT(chall_id) AS chall_num , solver_id, solver_name FROM
(SELECT h.hacker_id AS solver_id, h.name AS solver_name, s.challenge_id AS chall_id, s.score AS solver_score, d.score AS max_score FROM Hackers AS h JOIN submissions AS s ON h.hacker_id = s.hacker_id JOIN challenges AS ch ON ch.challenge_id = s.challenge_id JOIN difficulty AS d ON d.difficulty_level = ch.difficulty_level) AS tot_1 WHERE solver_score = max_score GROUP BY solver_id, solver_name ) AS tab_2 WHERE chall_num >1 ORDER BY chall_num DESC, solver_id ASC;