SQL statement for selecting the most commented blog posts in WordPress
This is just a simple SQL statement that lists your 10 most commented WordPress articles: SELECT p.ID, p.post_title, count(comment_ID) AS num_comments FROM wp_posts p, wp_comments c WHERE p.ID=c.comment_post_ID GROUP BY p.ID, p.post_title ORDER BY num_comments DESC LIMIT 0,10;