728x90
select h.hacker_id, h.name, sum(b.score) as sum_score
from hackers as h
join (select hacker_id, challenge_id, max(score) as score
from submissions
group by hacker_id, challenge_id
) as b on h.hacker_id = b.hacker_id
group by 1,2
having sum_score > 0
order by sum_score desc, hacker_id asc
728x90
'데이터 분석 > [SQL] 기초' 카테고리의 다른 글
[HackerRank] MySQL - Occupations (0) | 2025.03.20 |
---|---|
[hackerrank] MySQL - The Report (0) | 2025.03.20 |
[hackerrank] MySQL - Challenges (0) | 2025.03.20 |
[프로그래머스] SQL 연습 String, Date - 자동차 대여 기록별 대여 금액 구하기 (0) | 2025.03.14 |
[프로그래머스] SQL 연습 GROUP BY - 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기 (0) | 2025.03.11 |