题解 | 商品价格排名
商品价格排名
https://www.nowcoder.com/practice/119f5b8cfe5b45779a3e1b3f4d83b341
SELECT a.product_id,a.product_name,a.type,a.price FROM( SELECT *,DENSE_RANK() OVER(partition by type order by price DESC) ranking FROM product_info ) a WHERE a.ranking IN(1,2) ORDER BY a.price DESC,a.product_id LIMIT 3;