i have a table in my database named subscriber which contains two rows one for the subscriber id and another one for points earned by each subscriber . My Select query :
SELECT 1000 * ( LOYALTY_POINTS DIV 1000 ) AS 'from', 1000 * ( LOYALTY_POINTS DIV 1000 ) +1000 AS 'to', COUNT( * ) AS NUMBER FROM SUBSCRIBER GROUP BY LOYALTY_POINTS DIV 1000
should return for each range of points the number of subscribers but unfortunately it only returns the number of subscribers different than zero. My result is:
from to NUMBER
0 1000 8
1000 2000 2
3000 4000 1
I want the query to return records with zero coun also.
The result should be:
from to NUMBER
0 1000 8
1000 2000 2
2000 3000 0
3000 4000 1
How to do it? Thank you in advance.