题解 | #平均播放进度大于60%的视频类别#

平均播放进度大于60%的视频类别

https://www.nowcoder.com/practice/c60242566ad94bc29959de0cdc6d95ef

with tt1 as(
select tag,concat_ws('',substr(round(sum(guankanshichang)/sum(duration),4)*100,1,5),'%') as	avg_play_progress from
    (select
            t1.start_time,
            t1.end_time,
            t2.duration,
            t2.tag ,
            case when unix_timestamp(end_time) - unix_timestamp(start_time) <= t2.duration
                     then  unix_timestamp(end_time) - unix_timestamp(start_time)
                 when  unix_timestamp(end_time) - unix_timestamp(start_time) > t2.duration
                     then t2.duration
                end as guankanshichang
     from tb_user_video_log t1
              join tb_video_info t2
                   on t1.video_id = t2.video_id) t1
group by tag
order by avg_play_progress desc
)select * from tt1 where round(substr(avg_play_progress,1,5)/100,4) > 0.6000 ;

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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