with latest_order as (
    select order_id, customer_id, order_date
    from (
        select order_id, customer_id, order_date,
        row_number() over (partition by customer_id order by order_date desc) as rn
        from orders
    ) temp
    where rn=1
)
select order_id, customer_name, order_date
from latest_order t join customers cus on t.customer_id=cus.customer_id