PostgreSQL - Joins in PostgreSQL
Given the tables:
What will this query return?
users(id, name)orders(id, user_id, amount)What will this query return?
SELECT u.name, o.amount FROM users u JOIN LATERAL (SELECT amount FROM orders WHERE user_id = u.id ORDER BY amount DESC LIMIT 1) o ON true;
