I can only imagine doing this with two database queries. The first finds the number of rows in the database, and the second selects with an
ORDER BY on the column I am interested in and
LIMIT X, 1 where X is half the number of rows.
Is there a simple way to do this with only one query?
Right now I am using averages in my calculations, but I think the mean would be better; there is no upper bound to the values and they are bounded from below by 0.
EDIT: yes, I meant to say 'median' but was having some brain error & searched for 'mean'. I have now found the answer over at stackoverflow