第二题的解法: select p_date,mid,row_number() over(partition by p_date order by post_count) as rak from (select p_date,mid,count(*) as post_count from t group by p_date,mid order by post_count desc) where ran<=10