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
- Contest Leaderboard
- Discussions
Contest Leaderboard
Contest Leaderboard
Sort by
recency
|
2270 Discussions
|
Please Login in order to post a comment
can anyone please explain why this code is giving error
select hacker_id,name, sum(max_score) from ( select h.hacker_id,h.name,s.challenge_id,max(s.score) as max_score from hackers h join submissions s on h.hacker_id=s.hacker_id group by hacker_id,name,challenge_id
) max_table group by hacker_id,name having sum(max_score)!=0 order by sum(max_score) desc,hacker_id
Can someone explain what am I doing wrong? Code:-
select hacker_id, name, sum(score) as mx from ( select h.hacker_id, h.name, s.challenge_id, max(s.score) as score from hackers h join submissions s on h.hacker_id = s.hacker_id group by h.hacker_id, h.name, s.challenge_id ) a group by hacker_id, name having mx > 0 order by mx desc, hacker_id