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.
select t1.submission_date, t1.un_hack, t2.hacker_id, name, total_sub from
(select submission_date, count(distinct hacker_id) as un_hack
from submissions
group by submission_date) as t1,
(select submission_date, hacker_id, count(submission_id) as total_sub
from submissions
group by submission_date, hacker_id) as t2,
hackers h
where t1.submission_date=t2.submission_date and h.hacker_id=t2.hacker_id
order by t1.submission_date
But now i am not able to extract the single row(hacker with max submission) for each date.
Could you please help.
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 you please explain the above solution?
My solution is below:(in MySql)
select t1.submission_date, t1.un_hack, t2.hacker_id, name, total_sub from (select submission_date, count(distinct hacker_id) as un_hack from submissions group by submission_date) as t1, (select submission_date, hacker_id, count(submission_id) as total_sub from submissions group by submission_date, hacker_id) as t2, hackers h where t1.submission_date=t2.submission_date and h.hacker_id=t2.hacker_id order by t1.submission_date
But now i am not able to extract the single row(hacker with max submission) for each date.
Could you please help.