Created
February 21, 2013 06:36
-
-
Save benmay/5002723 to your computer and use it in GitHub Desktop.
Grab number of comments on posts during 2012, in category cricket.
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(p.comment_count) FROM wp_posts p | |
JOIN wp_term_relationships tr ON tr.object_id = p.ID | |
JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id | |
JOIN wp_terms t ON t.term_id = tt.term_id | |
WHERE t.name = 'Cricket' | |
AND `post_date` >= '2012-01-01 00:00:00' | |
AND `post_date` <= '2013-01-01 00:00:00' | |
AND p.post_status = 'publish' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment