Hi,
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:
Hi,
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:
Try:
YourModelClass.find(:all, :select => "call_queue_id,agent_id,count(*) AS count", :group => "call_queue_id,agent_id", :order => "call_queue_id,agent_id")
-Paul
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?
raj
Unfortunately that won't work. Rails doesn't support :group when an :include is specified.
-Paul