Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

SQL Join Pitfalls: LEFT JOIN Turned Inner by WHERE, Row Fan-Out, NOT IN with NULL and Anti-Joins

Self-Hosting & Infra intermediate 6 min read $0.01 Updated 2026-10-20

Executed on SQLite 3.37: LEFT JOIN with WHERE versus ON conditions, count(*) versus count(child.id), joined sums inflated by fan-out, NOT IN returning an empty set after a NULL appears, and NOT EXISTS or LEFT JOIN IS NULL as safe anti-joins.

Reports go wrong in joins: a WHERE filter silently removes unmatched rows, counts inflate after joining a child table, and NOT IN returns nothing when the list contains NULL. Each case is reproduced with fixes.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →