PostgreSQL - Subqueries in PostgreSQL
What will be the output of this query?
Assuming user 1 has orders 10, 20 and user 2 has no orders.
SELECT u.id, o.amount FROM users u LEFT JOIN LATERAL (SELECT amount FROM orders WHERE user_id = u.id ORDER BY amount LIMIT 1) o ON true;Assuming user 1 has orders 10, 20 and user 2 has no orders.
