with temp as ( select p1.cid as cid, sum(if( (p1.start_time between p2.start_time and p2.end_time) , 1, 0)) as peak from play_record_tb p1 join play_record_tb p2 on p1.cid = p2.cid group by p1.id, p1.cid, p1.start_time ) select cid, round(cast(max(peak) as float),3) as max_peak_uv from temp group by...