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

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

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

注意排序,因为要倒序字段的'%'是连接而来的,怕直接用该字段倒序可能报错。于是写具体语句倒序,而不是直接用select中的字段名。 ps:但我因为>60写成了0.6,错了两次。

select tag,concat(round(100*avg(if(cnt>1,1,cnt)),2),'%')  avg_play_progress from (
select tag,timestampdiff(second,start_time,end_time)/duration cnt
from
tb_user_video_log t1
left join  tb_video_info t2
on t1.video_id=t2.video_id ) a
group by tag
having round(100*avg(if(cnt>1,1,cnt)),2) > 60
order by avg_play_progress desc 
全部评论

相关推荐

07-15 11:35
门头沟学院 Java
心里踏实多了,可以安心准备论文了
看不见我ffgh:牛哇佬,要不要来试一试pdd,部门氛围很好
京东开奖153人在聊
点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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