-- 计算出最终所需要的所有参数 with t1 as ( select t1.video_id, SUM(CASE WHEN TIMESTAMPDIFF(SECOND, t1.start_time, t1.end_time) >= t2.duration THEN 1 ELSE 0 END) / COUNT(t1.video_id) AS a, -- 视频完播率 sum(t1.if_like) as b, -- 点赞数 count(t1.comment_id) as c, -- 评论数 sum(t1.if_retweet) as d, -- ...