Created
December 23, 2014 11:39
-
-
Save atopal/75cdf3e085b205c568cb to your computer and use it in GitHub Desktop.
Number of upvotes per contributor and product
This file contains hidden or 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 `auth_user`.`username`, count(*) as votes | |
FROM `questions_answer` | |
JOIN `questions_answervote` ON `questions_answervote`.`answer_id` = `questions_answer`.`id` | |
JOIN `questions_question` ON `questions_question`.`id` = `questions_answer`.`question_id` | |
JOIN `auth_user` ON `auth_user`.`id` = `questions_answer`.`creator_id` | |
WHERE `questions_answervote`.`created` >= '2014-01-01' AND`questions_answervote`.`created` <= '2014-12-01' | |
AND `questions_question`.`product_id`=2 | |
AND `questions_answervote`.`helpful`=1 | |
GROUP by `questions_answer`.`creator_id` ORDER BY votes DESC limit 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment