How did I know that Earl would be the one to show me the error of my ways... Thanks, Earl that did the trick. Nancy E. Wichmann, PMP ________________________________ From: Earl Miles <merlin@logrus.com> To: development@drupal.org Sent: Thu, April 8, 2010 2:21:28 PM Subject: Re: [development] Strange query problem On 4/8/2010 11:07 AM, nan wich wrote:
$query = "SELECT nc.nid, n.title, nc.daycount AS views, nc.totalcount, " . "(SELECT COUNT(*) FROM {comments} c WHERE c.timestamp >= %d AND c.nid=nc.nid) AS comments_today, " . "cs.comment_count " . "FROM {node_counter} nc " . "INNER JOIN {node} n ON n.nid=nc.nid " . "LEFT JOIN {node_comment_statistics} cs ON cs.nid=nc.nid " . "WHERE nc.daycount > 0 " . "ORDER BY nc.daycount DESC"; $result = pager_query($query, $page_limit, 0, NULL, $today);
pager_query() is failing you because it can't rewrite that properly. You need to write your own count query for pager_query().