I'm trying to do a query on wpdb to get the posts commented on most in the past week... Any ideas what I'm doing wrong?
$querystr = "SELECT comment_count, ID, post_title
FROM $wpdb->posts wposts, $wpdb->comments wcomments
WHERE wposts.ID = wcomments.comment_post_ID
AND wcomments.comment_date >= CURDATE() - 7
GROUP BY wposts.ID
ORDER BY comment_count DESC
LIMIT 0 , 10
";
$pageposts = $wpdb->get_results($querystr);
The query seems to get top commented posts of all time, instead of the top commented posts that have been commented on in the past week.
Thanks in advance.