select * from ( select t2.cid,pv, row_number()over(order by pv desc, release_date desc ) as rk from ( select cid,sum(pv) as pv from( select cid, uid,count(1) as pv from play_record_tb group by cid ,uid having count(1) >1 )t group by cid ) t1 inner join course_info_tb t2 on t1.cid= t2.cid )t where rk<=3
某人对某视频重复观看,cid+uid count >1