题解 | 商品销售排名

商品销售排名

https://www.nowcoder.com/practice/79c6c3d6d66946f79387bca73c0a29f4


with tiaojian as (
select 
lg.product_id,
type,
product_name,
sum(price) as py,
dense_rank()over(order by sum(price) desc,product_name asc) as pdiff
from user_client_log lg inner join product_info pf on 
lg.product_id=pf.product_id
where
step="select"
group by lg.product_id,type,product_name
)

select 
product_name,
cast(py as signed) as py
from tiaojian
where
pdiff<=2

全部评论

相关推荐

想玩飞盘的菠萝蜜在春...:上交✌🏻也拒?
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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