DISTINCT
DISTINCT ON (The "Pick One" Logic, unique to Postgres)
SELECT DISTINCT ON (customer_id)
customer_id,
order_date,
amount
FROM orders
ORDER BY customer_id, order_date DESC;Last updated