select
        cid,
        cast(max(cnt) as decimal(10,3)) as max_peak_uv
from (
    select
        prt.cid,
        count(if(prt.start_time between prt1.start_time and prt1.end_time,1,null)) as cnt
    from 
            play_record_tb as prt
    inner join 
            play_record_tb as prt1
    on 
            prt.cid = prt1.cid
    group by 
            prt.id,prt.cid,prt.start_time
)a
group by 
        cid
order by 
        max_peak_uv desc
limit 3