The Names and faces have changed to protect the logic...
SELECT queue.name AS queueName, AVG(queue.endtime - queue.starttime) AS avgTime, COUNT(queue.id) AS callCount, queue.date AS queueDate
FROM resourcegroup
INNER JOIN contactroutingdetail ON (resourcegroup.resourcegroupid = contactroutingdetail.rsrcgroupid)
WHERE queue.date BETWEEN somestartdate AND someenddate
GROUP BY queue.name, queue.date
ORDER BY queue.date, queue.name
Doing an Inner join while speed up your query.. (But if the tables are under 100,000 records you probably wont notice)
That is the basic layout though, you might have to do some datatype changes.
Personally I hate putting in a timestamp field where the date is going to be queried... I would much rather have 2 fields, one for date and one for time. It makes the SQL a lot simplar.