Posted by Mandeep, Jan. 15, 2023, 2:24 a.m.
182. Top 5 content by number of watchers
I am trying to solve this problem but I am getting this error with this query
with tmp as (
select na.account_id,
nc.content_id,
sum(nd.duration) as total_watched,
nd.date as date_watched
from netflix_account na
inner join netflix_daily_streaming nd on
na.account_id = nd.account_id
inner join netflix_content nc on
nc.content_id = nd.content_id
where datediff(nd.date,nc.release_date) < 28
group by na.account_id, nc.content_id
having sum(nd.duration) > 600
),
tmp2 as (
select content_id,
count (account_id) as uu_cnt
from tmp
group by content_id
)
select content_id,
uu_cnt
from tmp2
order by uu_cnt desc
limit 5;
I am getting the error
Bad Request