select tag, concat (avg_play_progress,'%') as avg_play_progress from ( select tag, round( avg( case when timestampdiff (second, start_time, end_time) > duration then 1 else timestampdiff (second, start_time, end_time) / duration end ) * 100, 2 ) as avg_play_progress from tb_user_video_log a join ...