Possible Duplicate:
In SQL, how can you “group by” in ranges?
i have table like that
price
id | prices
1 | 3910
2 | 4125
3 | 3740
4 | 2700
5 | 1600
6 | 2150
7 | 2430
my wished output is like that
1500-1999 | 2000-2499 | 2500-2999 | 3000-3499 | 3500-3999 | 4000-4499 | allvalues
--------------------------------------------------------------------------------------
1 | 2 | 1 | 0 | 2 | 1 | 7
expli :
1500-1999 --> means i want count numbers which are between 1500 and 1999 and so on , with others.
allvalues is to count all values .
*here is the sql fiddle if someone need to test it there.
hope all is clear , thanks for any help.