Postgresql中每一类别的前10条数据查询

2023-05-16

以下sql中的内层查询【row_number() over (partition by transactionchannel order by transactiontype ,sumalltranscount desc)】意思是,根据transactionchannel 分组,然后根据transactiontype ,sumalltranscount倒叙排列,row_number是根据以上条件生成的序号

select * fromselect transactionchannel, transactiontype, sumalltranscount, avgrsp, datetime, name, row_number() over (partition by transactionchannel order by sumalltranscount desc) as rn from public.daily_report_business_entrust) a where a.rn <11
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Postgresql中每一类别的前10条数据查询 的相关文章

随机推荐