Use HAVING to filter grouped results
How many customers have made more than one purchase? I'm trying to understand our repeat purchase rate. Just need the count of repeat buyers — don't count refunds as purchases.
Each hint you reveal reduces the XP you can earn. Try the query first.
First, find customers with more than one purchase: `GROUP BY customer_id HAVING COUNT(*) > 1` on `fact_purchases WHERE amount > 0`
That gives you the repeat buyers — but you need to COUNT them. Wrap it in a subquery: `SELECT COUNT(*) FROM (...) sub`
Alias the final result: `SELECT COUNT(*) AS repeat_customers FROM (...) sub` — the subquery needs an alias like `sub` after the closing parenthesis