Skip to content

Instantly share code, notes, and snippets.

@verma
Created December 9, 2012 15:19
Show Gist options
  • Save verma/4245558 to your computer and use it in GitHub Desktop.
Save verma/4245558 to your computer and use it in GitHub Desktop.
Find all agents who have an average score above a certain threshold.
SELECT SUM(IF(average_score>65,1,0)) AS above_threshold, COUNT(*) AS total FROM
( SELECT agent_id, AVG(score) AS average_score
FROM recordings
JOIN evaluations ON recordings.id = evaluations.recording_id
GROUP BY agent_id) AS T;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment