Comment Comment by nightfly Is that different/better/worse than? select customer_id, max(order_id) from orders group by customer_id order by customer_id parent nightfly 3 years ago