elsenorjose
Technical User
I have a table tblCALL which stores a unique ID for a call, when the call made a request of the CTI (computer telephony interface)(datetime value in CTIREQUEST field) and whether the call was answered or not (datetime value in the ANSWERED column or NULL if not answered). I need to create a daily grouping of calls offered (a count of all unique IDs since ALL calls get one) a count of 'lost' or abandoned calls (a count of calls with NULL in the ANSWERED column) and the percentage of abandons to calls offered.
So, in my limited knowledge of MySQL, I tried this:
SELECT COUNT(C.ID) 'CALLS',
COUNT(A.ID) 'ABANDONS'
SUM(COUNT A.ID)/SUM(COUNT C.ID) 'ABANDON %'
FROM tblCALL C
LEFT JOIN tblCALL A
ON C.ID = A.ID
WHERE A.ANSWERED IS NULL
I am getting a result for calls (23,453) but nothing for abandons even though I know there are several. I'll clarify further if this is not enough but I hope what I'm trying to accomplish is clear in my example. Thanks.
So, in my limited knowledge of MySQL, I tried this:
SELECT COUNT(C.ID) 'CALLS',
COUNT(A.ID) 'ABANDONS'
SUM(COUNT A.ID)/SUM(COUNT C.ID) 'ABANDON %'
FROM tblCALL C
LEFT JOIN tblCALL A
ON C.ID = A.ID
WHERE A.ANSWERED IS NULL
I am getting a result for calls (23,453) but nothing for abandons even though I know there are several. I'll clarify further if this is not enough but I hope what I'm trying to accomplish is clear in my example. Thanks.