with t1 as (select cid,timestampdiff(second,start_time,end_time)/60 as count_time,score from play_record_tb where date(start_time) < '2022-01-09') select cid,count(cid) as pv,floor(sum(count_time)) as time_len from t1 group by cid having avg(score) >= 3 order by count(cid) desc,sum(count_time) desc limit 3

京公网安备 11010502036488号