I''m stumped...
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
FROM deals
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
removed)
I found this which I can adapt but it requires two sql statements
http://www.gloomy.eu/mysql-desired-percentage-of-rows/
And this helpful article explains how to execute multiple statements in
rails but it doesn''t seem to work with variables.
http://public.ok2life.com/welcome/index/46.html
Anyone have any other ideas?
Thanks
Luke
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---