SELECT tag, CONCAT(CAST( round(100*AVG(IF(TIMESTAMPDIFF(second, start_time, end_time)<=duration,TIMESTAMPDIFF(second, start_time, end_time),duration)/duration),2) AS CHAR),'%') avg_play_progress FROM tb_user_video_log JOIN ...