select ny, dense_rank() over (partition by ny, gfbm order by zpf desc) as pm from table;
select ny, rank() over (partition by ny, gfbm order by zpf desc) as pm from table;
select ny, row_number() over (partition by ny, gfbm order by zpf desc) as pm from table;

上面三种方式对应排名如下:

PgSQL——查询某字段每个月的排名_数据库