select tvl.video_id,round(avg(if(timestampdiff(second,start_time,end_time)>=duration,1,0)),3)//round(avg(case when timestampdiff(second,start_time,end_time)>= duration then 1 else 0 end),3)avg_comp_play_ratefrom tb_user_video_log tvl ...