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:
±----------------±------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±----------------±------------±-----±----±--------±---------------+
| id | int(11) | | PRI | NULL | auto_increment |
| call_queue_id | int(11) | YES | | NULL | |
| agent_id | int(11) | | | 0 | |
| start_time | datetime | YES | | NULL | |
| end_time | datetime | YES | | NULL | |
| status | char(1) | YES | | c | |
±----------------±------------±-----±----±--------±---------------+
How can I express this query using find?
Right now I am using find_by_sql, but I would like to use find because
I want to use with_scope (I am assuming that with_scope will not work
with find_by_sql)
regards,
raj