Your finance team wants a monthly report of customer reach — not total orders, but how many distinct customers placed an order each month. Using the orders table, return month (formatted as YYYY-MM) and unique_buyers (count of distinct customers who placed at least one order that month). Sort by month ascending.
orders
| column | type |
|---|---|
| id | INTEGER |
| customer_id | INTEGER |
| amount | NUMERIC |
| order_date | DATE |
| id | customer_id | amount | order_date |
|---|---|---|---|
| 1 | 1 | 50.00 | 2024-01-10 |
| 2 | 2 | 30.00 | 2024-01-15 |
| 3 | 1 | 20.00 | 2024-01-20 |
| 4 | 3 | 75.00 | 2024-02-05 |
| 5 | 1 | 40.00 | 2024-02-10 |
| 6 | 2 | 60.00 | 2024-02-10 |
| month | unique_buyers |
|---|---|
| 2024-01 | 2 |
| 2024-02 | 3 |
In January, customers 1 and 2 placed orders (customer 1 placed two, but counts once). In February, customers 1, 2, and 3 all ordered.