step1:使用vidio_id相等的条件,将user_view_tb左连接vidio_info_tb;

step2:限定类型为“番剧”,观看视频日期为'2021-1-1';

step3:按vidio_name分组,显示每种视频名称的观看人数;

step4:逆序显示第一条数据。

SELECT video_name, count(distinct user_id) as num

from user_view_tb a

left join video_info_tb b

on a.video_id=b.video_id

where video_type='番剧' and view_date='2021-1-1'

group by video_name

order by num desc, a.video_id asc limit 1;