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

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

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

select 
    video_id,
    round((100*wb_rt+5*lcnt+3*ccnt+2*recnt)/(1+npcnt),0) as hot_index
from(
    select
        a.video_id,
        sum(if(timestampdiff(second,start_time,end_time)>=duration,1,0))/count(1) as wb_rt,
        sum(if_like) as lcnt,
        sum(if_retweet) as recnt,
        count(comment_id) as ccnt,
        datediff(date((select max(end_time) from tb_user_video_log)),max(date(end_time))) as npcnt
    from 
        tb_user_video_log as a
    join 
        tb_video_info as b
    on a.video_id =b.video_id
    and datediff(date((select max(end_time) from tb_user_video_log)),date(release_time)) <= 29
    group by 1) as t
order by hot_index desc
limit 3

全部评论

相关推荐

头顶尖尖的程序员:我也是面了三四次才放平心态的。准备好自我介绍,不一定要背熟,可以记事本写下来读。全程控制语速,所有问题都先思考几秒,不要急着答,不要打断面试官说话。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务