题解 | #近一个月发布的视频中热度最高的top3视频#

近一个月发布的视频中热度最高的top3视频

https://www.nowcoder.com/practice/0226c7b2541c41e59c3b8aec588b09ff

with t1 as(
select (select date(max(end_time)) from tb_user_video_log) as current_t,
uid,
tl.video_id,
start_time,
end_time,
if_follow,
if_like,
if_retweet,
comment_id,
duration,
release_time
from tb_user_video_log tl
left join tb_video_info ti
on tl.video_id=ti.video_id
)
select video_id,
round((wanbo*100+like_cnt*5+comment_count*3+retweet_cnt*2)/(wubo+1)) as hot_index
from(
select video_id,
sum(if_like) like_cnt,
count(comment_id) comment_count,
sum(if_retweet) retweet_cnt,
count( case when timestampdiff(second,start_time,end_time)>=duration then video_id else null end)/count( video_id) as wanbo,
datediff(current_t,date(max(end_time))) as wubo
from t1
where datediff(current_t,DATE(release_time))<30
group by video_id
)a
order by hot_index desc
limit 3

全部评论

相关推荐

11-09 17:30
门头沟学院 Java
TYUT太摆金星:我也是,好几个华为的社招找我了
点赞 评论 收藏
分享
安静的仰泳鲈鱼sp到手了:你这比赛获奖和实习,跟你的技术栈有半点关系吗😮
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务