For each month with orders (month = first day), count new_customers (first-ever order in that month) and returning_customers (ordered before that month).
12 rows with columns month, new_customers, returning_customers — first 3 shown:
| # | |||
|---|---|---|---|
| 1 | 2024-01-01 00:00:00 | 3 | 0 |
| 2 | 2024-02-01 00:00:00 | 2 | 1 |
| 3 | 2024-03-01 00:00:00 | 2 | 1 |
Run your code to see the output here.