题解 | 查询订单
查询订单
https://www.nowcoder.com/practice/5ae7f48dc94f4a76b0ade40b70caf308
select
order_id,
customer_name,
order_date
from
(
select
a.order_id,
a.order_date,
b.customer_name,
row_number() over (
partition by
a.customer_id
order by
order_date desc
) as num
from
orders a,
customers b
where
a.customer_id = b.customer_id
) c
where
num = 1
order by
customer_name