Created
September 6, 2011 15:54
-
-
Save datwright/1197953 to your computer and use it in GitHub Desktop.
pass_fail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT u.id, u.name, COUNT(CASE WHEN `assessment_results`.passed = 1 THEN 1 ELSE NULL END) / COUNT(*) as pass_rate, COUNT(*) as total, COUNT(CASE WHEN `assessment_results`.passed = 1 THEN 1 ELSE NULL END) FROM users u | |
LEFT JOIN assessment_results ON assessment_results.user_id = u.id | |
WHERE u.certification_id = 3 | |
AND (u.certification_status = 'green' OR u.certification_status = 'yellow') | |
AND assessment_results.submitted = true | |
group by u.id | |
ORDER BY pass_rate DESC a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment