Skip to content

Instantly share code, notes, and snippets.

@Maqsim
Created November 25, 2013 10:32
Show Gist options
  • Save Maqsim/7639391 to your computer and use it in GitHub Desktop.
Save Maqsim/7639391 to your computer and use it in GitHub Desktop.
SELECT
(COUNT(`task_id`) / 66413) * 100 AS percent,
(SELECT `title` FROM `cats` WHERE `cat_id` = `tasks`.`cat_id`) as category
FROM `tasks`
GROUP BY `cat_id`
ORDER BY `percent` DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment