--按照分组名称取前10个,不足10个取已有的数量
SELECT news_id,bt,fbsj,zdzy,flid,flmc FROM ( SELECT T.*, (ROW_NUMBER() over (PARTITION BY flid ORDER BY fbsj desc)) RN FROM CRAWLER_NEWSINFO T ) WHERE RN < 11
--按照分组统计取出的数据 select a.flmc,count(a.flmc) from ( SELECT news_id,bt,fbsj,zdzy,flid,flmc FROM ( SELECT T.*, (ROW_NUMBER() over (PARTITION BY flid ORDER BY fbsj desc)) RN FROM CRAWLER_NEWSINFO T ) WHERE RN < 11 ) a group by a.flmc;