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.
why it is not working SELECT
c.contest_id,
c.hacker_id,
c.name,
SUM(ss.total_submissions) AS sum_of_total_submissions,
SUM(ss.total_accepted_submissions) AS total_acc_submissions,
SUM(vs.total_views) AS sum_of_total_views,
SUM(vs.total_unique_views) AS sum_total_unique_views
FROM contests AS c
JOIN colleges AS co
ON c.contest_id = co.contest_id
JOIN challenges AS ch
ON co.college_id = ch.college_id
JOIN view_stats AS vs
ON ch.challenge_id = vs.challenge_id
JOIN submission_stats AS ss
ON ch.challenge_id = ss.challenge_id
GROUP BY c.contest_id, c.hacker_id, c.name
HAVING
SUM(ss.total_submissions) > 0
OR SUM(ss.total_accepted_submissions) > 0
OR SUM(vs.total_views) > 0
OR SUM(vs.total_unique_views) > 0
ORDER BY c.contest_id;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Interviews
You are viewing a single comment's thread. Return to all comments →
why it is not working SELECT c.contest_id,
c.hacker_id, c.name, SUM(ss.total_submissions) AS sum_of_total_submissions, SUM(ss.total_accepted_submissions) AS total_acc_submissions, SUM(vs.total_views) AS sum_of_total_views, SUM(vs.total_unique_views) AS sum_total_unique_views FROM contests AS c JOIN colleges AS co ON c.contest_id = co.contest_id JOIN challenges AS ch ON co.college_id = ch.college_id JOIN view_stats AS vs ON ch.challenge_id = vs.challenge_id JOIN submission_stats AS ss ON ch.challenge_id = ss.challenge_id GROUP BY c.contest_id, c.hacker_id, c.name HAVING SUM(ss.total_submissions) > 0 OR SUM(ss.total_accepted_submissions) > 0 OR SUM(vs.total_views) > 0 OR SUM(vs.total_unique_views) > 0 ORDER BY c.contest_id;