Is it possible to SUM or AVG the top 10 results? I have a list of several thousand values. I want to know the average of the top 10 values. I tried this:
SELECT AVG(some_val)
FROM table
ORDER BY some_val DESC
LIMIT 10;
But this gives me the average of the entire list of values from the table, not just the top 10.
I'm using MySQL. I'd like to write this as one SQL statement.