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.
same in oracle :
select h.hacker_id, h.name, count(c.challenge_id) as total
from hackers h, challenges c
where h.hacker_id=c.hacker_id
group by h.hacker_id, h.name
having count(c.challenge_id) in --either in max
(
select max(total) from (
select count(*) as total from challenges
group by hacker_id )
)
or count(c.challenge_id) in--or should occur only once
(
select total from (
select count(*) as total from challenges
group by hacker_id)
group by total
having count(total)=1
)
order by count(c.challenge_id) desc, h.hacker_id ;
Challenges
You are viewing a single comment's thread. Return to all comments →
thank you..your logic is easy to understand...
same in oracle : select h.hacker_id, h.name, count(c.challenge_id) as total from hackers h, challenges c where h.hacker_id=c.hacker_id group by h.hacker_id, h.name
having count(c.challenge_id) in --either in max ( select max(total) from ( select count(*) as total from challenges group by hacker_id )
) or count(c.challenge_id) in--or should occur only once ( select total from ( select count(*) as total from challenges group by hacker_id) group by total having count(total)=1
) order by count(c.challenge_id) desc, h.hacker_id ;