Created
December 3, 2017 17:53
-
-
Save danieliser/81d0616cc414bcfeb4c13dc91175d07e to your computer and use it in GitHub Desktop.
Several queries used to pull review tracking data.
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
| /** | |
| * Returns count of unique site/user combinations. | |
| */ | |
| SELECT count(DISTINCT(uuid)) FROM `pmapi_pum_reviews` | |
| /** | |
| * Get count of each reason. | |
| * Use Having to limit these results or pivot the table. | |
| */ | |
| SELECT `reason`, COUNT(*) FROM `pmapi_pum_reviews` GROUP BY `reason` | |
| /** | |
| * Get count & percentage of each reason. | |
| * Use Having to limit these results or pivot the table. | |
| */ | |
| SELECT reason, COUNT(*) AS count, concat(FORMAT((SUM(100) / total),2),'%') AS percentage FROM `pmapi_pum_reviews` CROSS JOIN (SELECT COUNT(*) AS total FROM `pmapi_pum_reviews` ) x GROUP BY reason | |
| /** | |
| * Get list of reasons with more than 3 submissions. | |
| */ | |
| SELECT `reason`, count(*) from `pmapi_pum_reviews` group by `reason` having count(*) > 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment