Last active
August 29, 2015 14:11
-
-
Save dperrymorrow/186087c69ea9c09552de to your computer and use it in GitHub Desktop.
Percentage query in MySQL
This file contains 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 SUM((SELECT COUNT(*) FROM `posts` WHERE `approved` = 1) / | |
(SELECT COUNT(*) FROM `posts`) * 100) AS 'Percentage Approved' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment