题解 | 查询订单
查询订单
https://www.nowcoder.com/practice/5ae7f48dc94f4a76b0ade40b70caf308
select
order_id,
customer_name,
order_date
from
(
select
o.order_id,
c.customer_name,
o.order_date,
row_number() over (
partition by
c.customer_name
order by
o.order_date desc
) as rk
from
orders o
left join customers c on o.customer_id = c.customer_id
) r
where
rk = 1
order by
customer_name;
窗口函数越用越爱!!!

