My LEFT JOIN behaves like an INNER JOIN when I add a WHERE clause
Asked by Rafael Mendes · 840 views · 3 replies
I want every customer plus their orders from this year, including customers who ordered nothing. This is what I have:
SELECT c.name, o.total
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
WHERE o.created_at >= '2026-01-01';
Customers with no orders disappear completely. If I remove the WHERE they come back, so the join itself is fine. What am I missing?