I have a products table with a column for price and master category.
I’d like to query my DB to find the range of prices there are for a given category (or all categories). This range of prices would then be broken into an appropriate number of price-ranges ie £0-£5 £5-£10 etc…
I can’t get my head around how to do this; do I need to do this all with php?
EDIT: having had a wee think about it, to clarify, I would like to end up so that whatever category is being listed, I can show perhaps 4 price ranges with roughly equal numbers of products in each. I can’t get my feeble mind around it 🙁
For the min and max price per category:
For ranges directly in a query you could do something like this
yields
or
yields