WordPress Comment Stats Query

KarmaDude Jan 14, 2009 2 Comments

Here is a query you can run against your WordPress comments table to view total comments by year and month. If you use a different table name prefix, then substitute ‘wp’ with your table name prefix.

SELECT year(comment_date) as y, month(comment_date) as m, concat(substr(monthname(comment_date),1,3), " ", year(comment_date)) as month, count(*) as total
FROM wp_comments
GROUP BY y, m
ORDER BY m, y ASC

2 Comments

  • Soumen
    Feb 27, 2009 | 2:00 am

    Hi, the post is really simple but great tweak. I liked the site also.

    I will like to publish your interview in my blog.reply……

  • Chris
    Nov 23, 2009 | 2:18 pm

    Doesn’t this also pick up spam comments? You should include this “where comment_approved = 1″

Leave a Comment

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>