I need to return a number of rows with the top & bottom x percentage of
rows removed in mysql 4.x e.g.
SELECT COUNT() value_count,
SUM(deals.value) / COUNT() average_value
ORDER BY deals.value
Now say that returns the sum of 100 deals, what I actually need to do is
return the count & sum of rows 10-90 (i.e. the top & bottom 10% rows
I found this which I can adapt but it requires two sql statements
And this helpful article explains how to execute multiple statements in
rails but it doesn’t seem to work with variables.
Anyone have any other ideas?