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.
with cte as (select submission_date,count(distinct hacker_id)as cnt from Submissions group by submission_date)
, cte2 as (select submission_date , hacker_id , count()as sub_cnt , rank() over(partition by submission_date order by count()desc ,hacker_id asc)as rnk from Submissions group by hacker_id,submission_date)
select cte.submission_date , cte.cnt , cte2.hacker_id,h.name
from cte2
join Hackers h on h.hacker_id=cte2.hacker_id
join cte on cte2.submission_date=cte.submission_date
can anyone
where cte2.rnk=1
order by submission_date;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
15 Days of Learning SQL
You are viewing a single comment's thread. Return to all comments →
CAN ANYONE HELP WHY THIS DOESN'T WOTK
with cte as (select submission_date,count(distinct hacker_id)as cnt from Submissions group by submission_date) , cte2 as (select submission_date , hacker_id , count()as sub_cnt , rank() over(partition by submission_date order by count()desc ,hacker_id asc)as rnk from Submissions group by hacker_id,submission_date) select cte.submission_date , cte.cnt , cte2.hacker_id,h.name from cte2 join Hackers h on h.hacker_id=cte2.hacker_id join cte on cte2.submission_date=cte.submission_date
can anyone
where cte2.rnk=1 order by submission_date;