with t1 as( select cid, format(count(uid),3) as pv from play_record_tb group by cid,uid having pv > 1 ) select t1.cid, t1.pv, row_number() over(order by t1.pv desc, release_date desc) rk from t1 join course_info_tb using(cid) limit 3