with tmp as ( select coalesce(sum(if(TIMESTAMPDIFF(second, u.start_time, u.end_time) >= v.duration,1,0))*1.0/IF(count(*)=0,1,count(*)),0) as overper, ifnull(sum(u.if_like),0) as likeper, sum(IF(u.comment_id is not null,1,0)) as comper, sum(u.if_retweet) as reper, max(u.end_time) as maxtime, v.vid...