Skip to content

Instantly share code, notes, and snippets.

@atopal
Created April 24, 2013 11:39
Show Gist options
  • Select an option

  • Save atopal/5451507 to your computer and use it in GitHub Desktop.

Select an option

Save atopal/5451507 to your computer and use it in GitHub Desktop.
top forum contributors in the last 6 month
SELECT username, count(distinct(question_id)) as threadnum
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 > '2012-10-24' and qa.created <= '2013-04-24'
AND NOT qa.creator_id = qq.creator_id
GROUP BY username ORDER BY threadnum DESC LIMIT 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment