[development] Strange query problem

Earl Miles merlin at logrus.com
Thu Apr 8 18:21:28 UTC 2010


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().


More information about the development mailing list