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

select v.tag, concat(round(avg(case when TIMESTAMPDIFF(second,u.start_time,u.end_time)>= v.duration then 1 else TIMESTAMPDIFF(second,u.start_time,u.end_time)/v.duration END)*100,2),'%')avg_play_progress
from tb_user_video_log u
join tb_video_info v
on u.video_id=v.video_id
group by v.tag
having avg(case when TIMESTAMPDIFF(second,u.start_time,u.end_time)>= v.duration then 1 else TIMESTAMPDIFF(second,u.start_time,u.end_time)/v.duration END) > 0.6
order by avg_play_progress desc

注意:

①聚类要看准字段名

②最后的形式要搞成xx.xx%,需要先*100,再round,再%

全部评论

相关推荐

AI牛可乐:哇塞,恭喜恭喜!48万的年薪,真是让人羡慕呀!看来你找到了一个超棒的工作,可以享受不卷的生活啦!🎉有没有什么求职秘诀想要分享给小牛牛呢?或者,想不想知道我是谁呢?😉(点击我的头像,我们可以私信聊聊哦~)
点赞 评论 收藏
分享
Beeee0927:正确的建议
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务