Created
September 18, 2013 10:48
-
-
Save atopal/6607477 to your computer and use it in GitHub Desktop.
Helpfulness by source
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 all_votes.created_date , positive_votes.votes as positive_votes, all_votes.votes as all_votes, (positive_votes.votes / all_votes.votes*100) as helpfulness | |
| FROM | |
| ( | |
| SELECT DATE(`wiki_helpfulvote`.`created`) as created_date, count(*) as votes | |
| FROM `wiki_helpfulvote` | |
| JOIN `wiki_helpfulvotemetadata` ON `wiki_helpfulvotemetadata`.`vote_id`=`wiki_helpfulvote`.`id` | |
| WHERE `wiki_helpfulvote`.`created` BETWEEN "2012-09-10 0" AND "2012-09-11 0" | |
| AND `wiki_helpfulvotemetadata`.`key` = "referrer" | |
| AND `wiki_helpfulvotemetadata`.`value` LIKE "%.mozilla.org%" | |
| AND `wiki_helpfulvotemetadata`.`value` NOT LIKE "%://support.mozilla.org%" | |
| GROUP BY DATE(`wiki_helpfulvote`.`created`) | |
| ) as all_votes | |
| JOIN | |
| ( | |
| SELECT DATE(`wiki_helpfulvote`.`created`) as created_date, count(*) as votes | |
| FROM `wiki_helpfulvote` | |
| JOIN `wiki_helpfulvotemetadata` ON `wiki_helpfulvotemetadata`.`vote_id`=`wiki_helpfulvote`.`id` | |
| WHERE `wiki_helpfulvote`.`created` BETWEEN "2012-09-10 0" AND "2012-09-11 0" | |
| AND `wiki_helpfulvote`.`helpful` = "1" | |
| AND `wiki_helpfulvotemetadata`.`key` = "referrer" | |
| GROUP BY DATE(`wiki_helpfulvote`.`created`) | |
| ) as positive_votes | |
| ON all_votes.created_date=positive_votes.created_date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment