题解 | 商品价格排名
select product_id, product_name, type, price from ( select *, rank() over ( partition by type order by price desc ) as rk from product_info ) as a where a.rk in (1, 2) order by price desc, product_name asc limit 3
select product_id, product_name, type, price from ( select *, rank() over ( partition by type order by price desc ) as rk from product_info ) as a where a.rk in (1, 2) order by price desc, product_name asc limit 3
相关推荐