Filtering after the join can remove rows you meant to preserve.
Section: Common pitfalls
WHERE on the right side can break a LEFT JOIN
sql
sql
-- Problematic if you want all customers
SELECT c.customer_id, o.order_id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.customer_id
WHERE o.status = 'paid';Explanation
Move the right-side filter into `ON` if you still need unmatched left rows.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Common pitfalls
Missing or incomplete ON clause
A bad join predicate can explode row counts.
One-to-many joins can duplicate facts
Totals can be wrong when a base row joins to many detail rows.
Mismatched data types hurt join quality
Joining `INT` to `TEXT` or differently formatted keys can block index use and create hidden bugs.