You need to come up with the initial approach and then if you have specific questions or problems then you can post those and someone may be able to help you. If you haven't got a clue as to how to even start, then it's time to hit the books, use your brain or give up.
select count(*) as num from table
select * from table order by price limit 0, num/3
select * from table order by price limit num/3, num/3
select * from table order by price limit 2*num/3. num/3
not a mean price, set around 3 median price groups, you can do the math to create means from the price data
what does the limit does? and what do you mean by set around 3 median price groups? Actually what i was thinking was to group the price into asc, then the first with the last in one group, the second first and the second last into another group and so on. so i create the array,
$group1 = new arraylist(1,6,11,20,25);
$group2 = new arraylist(2,7,12,29,24);
note: my number of fruit is fixed.
i am stuck here after that. Not sure how to link them together.