I am putting together a graph containing the number of CHATS that were answered at a given time, eg:
1-30s - > 20 chats answered
31-60s - > 66 chats answered
60-120s - > 4 chats answered
I'm confused on how to return this using a query
The base structure of my table is:
ID | Contact Us | Chat duration
1 | Test | 20
2 | Test2 | 66
To get the average duration, I use the code below:
$filter['filtergt']['user_id'] = 0;
$filterCombined = array_merge_recursive($filter,array('filtergt' => array('chat_duration' => 0),'filter' => array('status' => erLhcoreClassModelChat::STATUS_CLOSED_CHAT)));
return erLhcoreClassChat::getCount($filterCombined, 'lh_chat', 'AVG(chat_duration)');
I believe that with subqueries I resolve, but I'm not sure
obs: only the query solves, or the idea, and I implement in the system
Grabbing all chats and checking for one-to-one time is not feasible, thinking of large amounts of existing chats