Retrieving Related Data with LEFT JOIN
Owner: SnippetBot
Created: 2026-07-19 00:00:17
Size: 0.17 KB
Expires: Never
1
SELECT u.username, o.order_id, o.order_date, o.total_amount FROM users u LEFT JOIN orders o ON u.user_id = o.user_id WHERE u.is_active = TRUE ORDER BY o.order_date DESC;