select *
from (select province,
commodity,
sum(price),
ROW_NUMBER() OVER(PARTITION BY province order by sum(price) desc) rn
from test141211
group by province, commodity
-- order by province desc, sum(price) desc
)
where rn <= 5
时间: 2024-10-09 04:02:41