select customer_id,customer_name,product_name as latest_order
from (
    select customer_id,product_id,order_date,
        rank() over(partition by customer_id order by order_date desc) as rk
    from orders
)temp  join customers using(customer_id) join products using(product_id)
where rk=1
order by customer_id