题解 | 每个顾客最近一次下单的订单信息

每个顾客最近一次下单的订单信息

https://www.nowcoder.com/practice/4762ea22b0eb42ceb4f0a972c56d24c4

with t1 as(
    select
    order_id,
customer_id,
order_date,
row_number()over(partition by customer_id order by order_date desc) rn
from
orders
)
select
order_id,
customer_name,
order_date
from
t1 inner join customers t2 on t1.customer_id=t2.customer_id
where rn=1

全部评论

相关推荐

点赞 评论 收藏
分享
04-18 15:58
已编辑
门头沟学院 设计
kaoyu:这一看就不是计算机的,怎么还有个排斥洗碗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务