SQL Recipes (Beta II)
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
  #1 (permalink)  
Old 05-19-2006, 06:01 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 77
ben has disabled reputation
Default MySQL dialect question:

Find Your Most-Commented Blog Categories in Wordpress?


How can I find out which blogging categories are the most commented?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 05-19-2006, 06:06 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 77
ben has disabled reputation
Default MySQL answer. Re: Find Your Most-Commented Blog Categories in Wordpress?

This question was posted on [a href="http://www.openwin.org/mike/index.php/archives/2006/05/find-your-most-commented-blog-categories/trackback/"]Mike Hillyer's blog[/a], which he kindly allowed to be posted here.

SELECT wp_categories.cat_name, COUNT(wp_comments.comment_id)
FROM wp_categories
LEFT JOIN wp_post2cat ON wp_categories.cat_id = wp_post2cat.category_id
LEFT JOIN wp_comments ON wp_post2cat.post_id = wp_comments.comment_post_id
WHERE comment_approved != ’spam’
GROUP BY wp_categories.cat_id
ORDER BY 2 DESC


+------------------------------------------+-------------------------------+
| cat_name | COUNT(wp_comments.comment_id) |
+------------------------------------------+-------------------------------+
| MySQL | 307 |
| Visual Basic 6 | 236 |
| General | 119 |
| Open Source | 43 |
| Rants | 42 |
| Crystal Reports | 40 |
| News | 39 |
| Gadgets | 26 |
| Windows | 24 |
| PHP | 21 |
| 2006 MySQL User's Conference & Expo | 13 |
| VB.NET | 12 |
| 2004 MySQL User's Conference & Expo | 10 |
| Reviews | 7 |
| 2005 MySQL User's Conference & Expo | 6 |
| Photography | 5 |
| MySQL Tip of the Week | 4 |
| Hardware | 3 |
| Money | 2 |
+------------------------------------------+-------------------------------+
19 rows in set (0.16 sec)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:52 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2007 SQL Recipes

1 2 3 4 5 6 7