题解 | 商品价格排名

商品价格排名

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 ) as rank_id,
product_id,product_name,type,price
from product_info 
) as a 
where rank_id<=2 
order by a.price desc ,a.product_name
limit 3

全部评论

相关推荐

12-03 03:32
安徽大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务