题解 | 查询订单

查询订单

https://www.nowcoder.com/practice/5ae7f48dc94f4a76b0ade40b70caf308

with o as(
select order_id,customer_id,order_date,row_number()over(partition by customer_id order by order_date desc) as rk from orders)
select o.order_id,c.customer_name,o.order_date
from o join customers c on o.customer_id=c.customer_id
where o.rk=1
order by c.customer_name

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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