diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 1e36560c40ebe546afd2fea29c88d357dcf2eaae..6133ed1643fa930dd3c38beccca72caa60c51b5b 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -983,6 +983,7 @@ function comment_render($node, $cid = 0) {
         $query_args[] = COMMENT_PUBLISHED;
       }
 
+      $query = db_rewrite_sql($query, 'c', 'cid');
       $result = db_query($query, $query_args);
 
       if ($comment = db_fetch_object($result)) {
@@ -1028,6 +1029,8 @@ function comment_render($node, $cid = 0) {
           $query .= ' ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))';
         }
       }
+      $query = db_rewrite_sql($query, 'c', 'cid');
+      $query_count = db_rewrite_sql($query_count, 'c', 'cid');
 
       // Start a form, for use with comment control.
       $result = pager_query($query, $comments_per_page, 0, $query_count, $query_args);
@@ -2208,4 +2211,4 @@ function comment_unpublish_by_keyword_action($comment, $context) {
       break;
     }
   }
-}
\ No newline at end of file
+}