• + 0 comments

    Above query is working while running and it is showing "Congratulations! You have passed the sample test cases." but while submitting it is showing "We couldn't process your submission. Please submit your code again". So I added CTE and submitted in MS SQL Server since CTE wasn't working in MySQL environment.

    MS SQL Server code: with vv as ( select Challenge_id, sum(total_views) tv, sum(total_unique_views) tuv from view_stats group by challenge_id), ss as ( select Challenge_id, sum(total_submissions) ts, sum(total_accepted_submissions) tas from Submission_Stats group by challenge_id) select con.contest_id, hacker_id, name, sum(ts), sum(tas),sum(tv),sum(tuv) from contests con inner join colleges col on con.contest_id=col.contest_id inner join challenges chal on col.college_id=chal.college_id left join vv on chal.challenge_id=vv.challenge_id left join ss on chal.challenge_id=ss.challenge_id group by con.contest_id, hacker_id, name having sum(ts)+sum(tas)+ sum(tv)+sum(tuv)>0 order by con.contest_id;