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

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

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

select 
	tag,
	avg_play_progress
from
(
select
	tag,
	concat(round(avg(
	case
		when process >= 1 then 1
		else process
	end 
	)*100,2), '%') avg_play_progress
	
from
	(
	select
		t2.tag,
		(TIMESTAMPDIFF(second,t1.start_time,t1.end_time)/t2.duration)  process
	from
		tb_user_video_log t1 ,
		tb_video_info t2
	where
		t1.video_id = t2.video_id
	) xxx 
group by tag 
) xxxx 
where cast((left(avg_play_progress,5)) as decimal(5,2)) > 60
order by avg_play_progress desc

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务