I am trying to modify MySQL output results.
Select number_purchases, COUNT(number_purchases) as user_count
FROM user_order
GROUP BY number_purchases
ORDER BY number_purchases ASC
so I get the number of purchases in the first column and the number of users that made that number of purchases in the second column.
I would like to modify the result a bit. I need a function around those lines:
If npb = 1, 2, 3... to 10 does not exist, add line with the missing npb and a corresponding user_count = 0