Skip to content

Instantly share code, notes, and snippets.

@wojtekmach
Created March 22, 2010 13:06
Show Gist options
  • Save wojtekmach/340055 to your computer and use it in GitHub Desktop.
Save wojtekmach/340055 to your computer and use it in GitHub Desktop.
select
question_id, cnt, total_cnt, 1.0 * cnt / total_cnt as ratio
from (
select question_id, sum(case when correct='f' then 1 else 0 end) as cnt,count(question_id) as total_cnt from quiz_questions group by question_id
)
order by ratio desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment