题解 | #平均播放进度大于60%的视频类别#
平均播放进度大于60%的视频类别
http://www.nowcoder.com/practice/c60242566ad94bc29959de0cdc6d95ef
SELECT
tag,
CONCAT(ROUND(AVG(IF(
TIME_TO_SEC(end_time)-TIME_TO_SEC(start_time)>=info.duration,
100,
(TIME_TO_SEC(end_time)-TIME_TO_SEC(start_time))/duration*100
)),2),'%') AS avg_play_progress
FROM tb_video_info info
JOIN tb_user_video_log log USING(video_id)
GROUP BY tag
HAVING SUBSTR(avg_play_progress,1,5)>60.00
ORDER BY avg_play_progress DESC