Hi. I am trying to get an average value from my database but I only want to retrieve the average out of the top 100 results. The column I want to average contains values from 0.1 to 10.0.
So I want to get the average from the top 100 values in this column. The average syntax is clear but what do I have to add?
This is what I have now:
$query="select AVG(M_RATING) as rating FROM rate_members WHERE M_COUNTRY='SE'";
But this gives me an average based on all values in the column.
I can't figure out how to do this. Even I guess there is an easy answer
So I want to get the average from the top 100 values in this column. The average syntax is clear but what do I have to add?
This is what I have now:
$query="select AVG(M_RATING) as rating FROM rate_members WHERE M_COUNTRY='SE'";
But this gives me an average based on all values in the column.
I can't figure out how to do this. Even I guess there is an easy answer