题解 | 查询订单
查询订单
https://www.nowcoder.com/practice/5ae7f48dc94f4a76b0ade40b70caf308
select
a.order_id,
c.customer_name,
a.order_date
from
orders a
inner join
(select
customer_id,
max(order_date) as order_date
from
orders
group by
customer_id) b on a.customer_id = b.customer_id and a.order_date = b.order_date
left join
customers c on a.customer_id = c.customer_id
order by
2
