Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress SQL: average comments per day over time
SELECT
'2010-11-24' AS date_begin,
'2015-01-26' AS date_end,
day_of_week,
AVG(comment_count) AS average_comments
FROM (
SELECT
comment_date,
DAYNAME(comment_date) day_of_week,
DAYOFWEEK(comment_date) day_num,
TO_DAYS(comment_date) date,
COUNT(*) AS comment_count
FROM
wp_comments
GROUP BY
comment_date
) temp_table
WHERE
comment_date >= '2010-11-24'
AND
comment_date < '2015-01-27'
GROUP
BY day_of_week
ORDER
BY day_num;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.