Skip to content

Instantly share code, notes, and snippets.

@atopal
Created October 8, 2014 14:05
Show Gist options
  • Save atopal/bfd6f5cce2ab2701a063 to your computer and use it in GitHub Desktop.
Save atopal/bfd6f5cce2ab2701a063 to your computer and use it in GitHub Desktop.
top contributors by posts in the forums
SELECT username, count(*) as answernum
FROM questions_question qq
JOIN questions_answer qa ON qa.question_id = qq.id
JOIN auth_user au ON qa.creator_id = au.id
WHERE qa.created >= '2014-08-06' and qa.created <= '2014-10-06'
AND NOT qa.creator_id = qq.creator_id
GROUP BY username ORDER BY answernum DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment