select customer_id, customer_name, product_name as latest_order from orders join customers using(customer_id) join products using(product_id) where (customer_id, order_date) in ( select customer_id, max(order_date) from orders group by customer_id ) order by 1



京公网安备 11010502036488号