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

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

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

select order_id,customer_name,order_date
from(
    select customer_name,customer_id,max(order_date) as order_date
    from orders join customers using(customer_id)
    group by customer_id,customer_name
) temp join orders using(order_date)
order by customer_name;

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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