Challenges 질문입니다.
SELECT H.hacker_id as hacker_id ,H.name as name ,COUNT(challenge_id) AS challenges_created FROM Hackers AS H INNER JOIN Challenges AS C ON H.hacker_id = C.hacker_id GROUP BY hacker_id,H.name HAVING COUNT(challenge_id) = (SELECT count(challenge_id) FROM Challenges GROUP BY hacker_id ORDER BY count(challenge_id) DESC Limit 1) OR /* COUNT(challenge_id) -> challenges_created 하면 해결*/ COUNT(challenge_id) IN (( SELECT small.number FROM( SELECT count(C.challenge_id) as number , H.name as name FROM Hackers as H INNER JOIN Challenges AS C ON H.hacker_id = C.hacker_id GROUP BY H.name,H.hacker_id ) AS small GROUP BY small.number HAVING count(small.name) =1 )) ORDER BY COUNT(challenge_id) DESC,hacker_id ---------------------------------- 이 부분이 문제였는데 무슨 차이인가요 ?? OR /* COUNT(challenge_id) -> challenges_created 하면 해결*/ COUNT(challenge_id) IN (( SELECT small.number FROM( SELECT count(C.challenge_id) as number , H.name as name FROM Hackers as H INNER JOIN Challenges AS C ON H.hacker_id = C.hacker_id GROUP BY H.name,H.hacker_id ) AS small GROUP BY small.number HAVING count(small.name) =1 )) ORDER BY COUNT(challenge_id) DESC,hacker_id