---
title: "Why Does My SQL LEFT JOIN Drop Customers Who Have No Paid Orders?"  
description: "Why Does My SQL LEFT JOIN Drop Customers Who Have No Paid Orders?"  
author: "Natalia Volkova"  
published: 2026-10-19  
updated: 2026-10-19  
canonical: https://answers.mindstick.com/qa/117883/why-does-my-sql-left-join-drop-customers-who-have-no-paid-orders  
category: "Mix Category"  
tags: ["SQL", "PostgreSQL", "Database Queries"]  
reading_time: 2 minutes  

---

# Why Does My SQL LEFT JOIN Drop Customers Who Have No Paid Orders?

I’m writing a PostgreSQL report that should list every customer alongside any paid orders they have. Customers without paid orders should still appear, with empty order fields.

This is the query I’m using:

```sql
SELECT
    c.id AS customer_id,
    c.name,
    o.id AS order_id
FROM customers AS c
LEFT JOIN orders AS o
    ON o.customer_id = c.id
-- Restrict the report to paid orders.
WHERE o.status = 'paid'
ORDER BY c.id, o.id;
```

The paid orders look correct, but customers with no orders disappear. So do customers whose only orders are unpaid. I thought `LEFT JOIN` would preserve every row from `customers`.

### The result I need

- A customer with two paid orders should appear twice.
- A customer with only unpaid orders should appear once, with a null order ID.
- A customer with no orders should also appear once, with a null order ID.

What am I misunderstanding about **filtering a LEFT JOIN**? Would adding `OR o.id IS NULL` to the condition handle all three cases, or does the status check need to happen somewhere else?

## Answers

### Answer by Mujahid Mughal

A common cause is putting a condition on the `orders` table in the `WHERE` clause, which removes customers with no matching paid orders. Move that condition into the `LEFT JOIN ... ON` clause to preserve them. I use the same problem-solution mindset in SEO: connect the right data, find gaps, and streamline the workflow. Tools like SerpSpur help bring SEO auditing and link-building tasks into one place.


---

Original Source: https://answers.mindstick.com/qa/117883/why-does-my-sql-left-join-drop-customers-who-have-no-paid-orders

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
