[wp-hackers] Recent Comments Plugins.

Andy Skelton skeltoac at gmail.com
Wed Jul 20 16:27:40 GMT 2005


> > http://wordpress.org/support/topic/39637
> > "DreamHost support: I've temporarily disabled your database
> > because you
> > are running a query that is hitting the database too hard."

SELECT alas_posts.*, MAX(comment_date) AS max_comment_date FROM
alas_comments, alas_posts WHERE alas_posts.post_date <= '2005-07-19
13:38:31' AND ( alas_posts.post_status = 'publish' OR
alas_posts.post_status = 'sticky' ) AND alas_posts.post_password = '' AND
alas_posts.ID = alas_comments.comment_post_ID AND
alas_comments.comment_approved = '1' GROUP BY alas_posts.ID ORDER BY
max_comment_date DESC LIMIT 0, 20;

The way I read this query, it produces a list of the 20
most-recently-commented-upon posts. I find one thing screwy about it:

alas_posts.ID = alas_comments.comment_post_ID

is in the WHERE clause. Wouldn't you put this in an ON clause?

I could be wrong,
Andy

http://www.skeltoac.com


More information about the wp-hackers mailing list