I'm trying to get the percentage of times something occurs (a task requires an outbound call)
So I made a count distinct of the occurrence "CALLED THE CUSTOMER" and aliased it as outbound_calls. And counted all the tasks alias "total_tasks"
These two steps work and I get this
Now I'm trying to divide outbound_calls by total_taks to get the percentage but get an error saying that the name oubound_calls is not recognized
This is the query I'm writing
SELECT
COUNT(DISTINCT IF(Out_CONTACT_TYPE = 'CALLED THE CUSTOMER', booking_id, NULL )) AS outbound_calls,
COUNT(task_id) AS total_tasks,
DIV(outbound_calls, total_tasks)
FROM `cs-reporting...`
Any ideas?
Happy Friday :)