From 630325188ac228f5cb1919b2ce48716ccbdc7e4e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 3 Oct 2003 11:42:52 +0000 Subject: - Performance improvement: removed redundant inner join. Patch by Kjartan. --- modules/comment/comment.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index f77dd65d9..caaca8f09 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1470,7 +1470,7 @@ function comment_num_all($nid) { static $cache; if (!isset($cache[$nid])) { - $comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = %d AND c.status = 0 GROUP BY n.nid", $nid)); + $comment = db_fetch_object(db_query("SELECT COUNT(nid) AS number FROM {comments} WHERE nid = %d AND status = 0 GROUP BY nid", $nid)); $cache[$nid] = $comment->number ? $comment->number : 0; } return $cache[$nid]; -- cgit v1.2.3