Postgresql查询每组的前N条记录
主函数:ROW_NUMBER() OVER (PARTITION BY "省份名称","地市名称" ORDER BY arpu desc ,dou DESC) AS row_id在原有数据表的基础上以 "省份名称","地市名称" 分组,按"arpu desc ,dou DESC"排序后,生成一个新字段row_id。然后再以row_id为筛选条件查询数据。<=3:只取前3天数据select * from ( select *,ROW_NUMBER() OVER (P...
原创
2021-09-28 11:54:35 ·
4648 阅读 ·
0 评论