Last active
December 13, 2015 22:29
-
-
Save atopal/4984994 to your computer and use it in GitHub Desktop.
Number/percentage of forum posts with trouble shooting information per day
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 number_of_questions.date_of_question as date_of_question, number_of_questions.number, datapoints.number_of_datapoints, (datapoints.number_of_datapoints/number_of_questions.number) as percentage_of_questions | |
| FROM | |
| ( | |
| SELECT DATE(`questions_question`.`created`) as date_of_question, count(*) as number_of_datapoints | |
| FROM `questions_question` | |
| JOIN `questions_questionmetadata` ON `questions_question`.`id`=`questions_questionmetadata`.`question_id` | |
| Where `questions_question`.`created` BETWEEN '2012-01-01 0' AND '2013-02-07 0' | |
| AND `questions_questionmetadata`.`name` LIKE 'troubleshooting' | |
| AND `questions_questionmetadata`.`value` LIKE '%Application Basics%' | |
| GROUP BY DATE(`questions_question`.`created`) | |
| ) as datapoints | |
| JOIN | |
| (SELECT DATE(`questions_question`.`created`) as date_of_question, count(*) as number | |
| FROM `questions_question` | |
| Where `questions_question`.`created` BETWEEN '2012-01-01 0' AND '2013-02-07 0' | |
| GROUP BY DATE(`questions_question`.`created`) | |
| ) as number_of_questions | |
| ON datapoints.date_of_question=number_of_questions.date_of_question |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment