Skip to content

Instantly share code, notes, and snippets.

@atopal
Created December 23, 2014 11:30
Show Gist options
  • Save atopal/d774e7f6624a58f810f4 to your computer and use it in GitHub Desktop.
Save atopal/d774e7f6624a58f810f4 to your computer and use it in GitHub Desktop.
Number of solutions per forum contributor per locale per product
SELECT `auth_user`.`username`, count(*) as solutions
FROM `questions_question`
JOIN `questions_answer` ON `questions_question`.`solution_id`=`questions_answer`.`id`
JOIN `auth_user` ON `questions_answer`.`creator_id`=`auth_user`.`id`
WHERE `questions_answer`.`created` >= '2014-01-01' AND `questions_answer`.`created` <= '2014-12-01'
AND `questions_question`.`product_id`=2
AND `questions_question`.`locale` = 'en-US'
GROUP BY `auth_user`.`id` ORDER by solutions DESC Limit 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment