题解 | #对比一周的播放完成率变化#

对比一周的播放完成率变化

https://www.nowcoder.com/practice/47852dbdf412481198597eaa1505ecd6

with cte as (
select uid,a.vid,time_len,weekday(start_time)+1 as weekth,
           unix_timestamp(end_time)-unix_timestamp(start_time) as seconds
from user_play_log_tb a left join video_info_tb b on a.vid=b.vid ),
cte1 as (
select weekth, avg(if(seconds<time_len,seconds/time_len,1)) as play_ratio
from cte
group by weekth
order by weekth
)
select weekth,
concat(round((lead(play_ratio,1,(select play_ratio from cte1 where weekth=1))over(order by weekth)-play_ratio)/play_ratio*100,1),'%') as play_ratio_delta
from cte1

两个率不应该这么减

全部评论

相关推荐

练习生懒羊羊:开飞机把这个公司创飞吧
点赞 评论 收藏
分享
06-26 17:24
已编辑
宁波大学 golang
迷失西雅图:别给,纯kpi,别问我为什么知道
点赞 评论 收藏
分享
牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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