Get to top 5 viewed videos which belong to both the genres "Action" (genre_id = 201 ) and "Comedy" (genre_id = 202).
video_name no_of_views
select vc.name,vc.no_of_views
from quiz.video as v,quiz.video_content as vc
where v.genre_id=201 and v.genre_id=202
limit 5;
Comments
SELECT video.name AS video_name, video.no_of_views AS no_of_views FROM video_genre INNER JOIN video ON video_genre.video_id = video.video_id WHERE video_genre.genre_id IN (201, 202) GROUP BY video.name ORDER BY no_of_views DESC, video_name ASC LIMIT 5;
Leave a comment