I am trying to write a query that returns the count of items whose price falls into certrain buckets:
For example if my table is:
item_name | price i
You can try grouping by 10 units of price:
SELECT COUNT(*) AS tally, FLOOR(price/10) AS prange, CONCAT(10*FLOOR(price/10), "-", 10*FLOOR(price/10)+9) AS rstr FROM my_table GROUP BY prange;