plain sql to find


I have a query like

SELECT call_queue_id,agent_id,count(*) AS count
FROM completed_calls
GROUP BY call_queue_id,agent_id
ORDER BY call_queue_id,agent_id

on a table with following structure:


YourModelClass.find(:all, :select => "call_queue_id,agent_id,count(*)
AS count", :group => "call_queue_id,agent_id", :order =>


Thanks!! That does work, but when I tried to use :include => this as
well as :group stopped working. Is there a way to get this working
with another table included in?


Unfortunately that won't work. Rails doesn't support :group when an
:include is specified.