<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You need to add in your own custom count query into the pager_query
(it's the 4th arguement). The standard regex that pager_query uses to
come up with it's own count query is what's breaking.<br>
<pre class="moz-signature" cols="72">Jamie Holly
<a class="moz-txt-link-freetext" href="http://www.intoxination.net">http://www.intoxination.net</a>
<a class="moz-txt-link-freetext" href="http://www.hollyit.net">http://www.hollyit.net</a></pre>
<br>
On 4/8/2010 2:13 PM, nan wich wrote:
<blockquote cite="mid:312316.75227.qm@web180303.mail.gq1.yahoo.com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div
style="font-family: Courier New,courier,monaco,monospace,sans-serif; font-size: 12pt;">
<div>I have other queries with subqueries that work just fine.<br>
</div>
<p><font size="4" color="#ff007f"
face="bookman old style, new york, times, serif"><em><strong>Nancy E.
Wichmann, PMP</strong></em></font></p>
<div><br>
</div>
<div
style="font-size: 12pt; font-family: Courier New,courier,monaco,monospace,sans-serif;"><br>
<div
style="font-size: 12pt; font-family: times new roman,new york,times,serif;"><font
size="2" face="Tahoma">
<hr size="1"><b><span style="font-weight: bold;">From:</span></b> T L
<a class="moz-txt-link-rfc2396E" href="mailto:tloud365@gmail.com"><tloud365@gmail.com></a><br>
<b><span style="font-weight: bold;">To:</span></b> development
<a class="moz-txt-link-rfc2396E" href="mailto:development@drupal.org"><development@drupal.org></a><br>
<b><span style="font-weight: bold;">Sent:</span></b> Thu, April 8,
2010 2:06:36 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re:
[development] Strange query problem<br>
</font><br>
Hey Nancy,<br>
<br>
I think Randy is right, I just ran a quick test with and without <a
moz-do-not-send="true"
href="http://api.drupal.org/api/function/db_rewrite_sql/6"
target="_blank" rel="nofollow">db_rewrite_sql</a>--it works without
db_rewrite_sql. This makes sense as db_rewrite_sql is among other
things a regex looking for SQL keywords ('from', 'where', etc) and
looks pretty much incompatible w/ subqueries.<br>
<br>
Sorry I don't have any ideas for a fix.<br>
<br>
Cheers,<br>
Tim<br>
<br>
<br>
<br>
<br>
<div class="gmail_quote">On Thu, Apr 8, 2010 at 1:39 PM, Randy Fay <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:randy@randyfay.com" target="_blank" rel="nofollow"
ymailto="mailto:randy@randyfay.com">randy@randyfay.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">There
may certainly be something going on with db_rewrite_sql(), so you'll
probably have to find out what the actual query is when it gets sent to
mysql. Stepping into db_query() is a great way to do this.<br>
<br>
-Randy
<div>
<div class="h5"><br>
<br>
<div class="gmail_quote">On Thu, Apr 8, 2010 at 11:20 AM, Aaron
Winborn <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:winborn@advomatic.com" target="_blank" rel="nofollow"
ymailto="mailto:winborn@advomatic.com">winborn@advomatic.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Can you post your Drupal query? Hard to troubleshoot w/o the
original code.
<div>
<div><br>
<br>
nan wich wrote:
<blockquote type="cite">
<div
style="font-size: 12pt; color: rgb(192, 0, 0); font-family: Courier New,courier,monaco,monospace,sans-serif;">
<div>I have the following query, which works fine in
PhpMyAdmin, but Drupal upchucks on it. Why?</div>
<div> </div>
<div><font color="#000000">SELECT nc.nid, n.title, n.created,
nc.daycount AS views_today, nc.totalcount AS total_views, <br>
(SELECT COUNT(*) FROM comments c WHERE c.timestamp >= 1270699200
AND c.nid=nc.nid) AS comments_today, <br>
cs.comment_count <br>
FROM node_counter nc <br>
INNER JOIN node n ON n.nid=nc.nid <br>
LEFT JOIN node_comment_statistics cs ON cs.nid=nc.nid <br>
WHERE nc.daycount > 0 <br>
ORDER BY nc.daycount DESC</font></div>
<div> </div>
<div>Yes, in Drupal, I do put the brackets around the table
names.</div>
<div> </div>
<div>The error message says there's a problem at " AS
comments_today, cs.comment_count FROM...".<br>
</div>
<p><font size="4" color="#ff007f"
face="bookman old style, new york, times, serif"><i><b>Nancy E.
Wichmann, PMP</b></i></font></p>
<p><font face="arial, helvetica, sans-serif"><span
style="font-size: 11pt; color: rgb(99, 36, 35);">Sometimes the
questions are complicated and the answers are simple. - Dr. Suess</span></font></p>
</div>
</blockquote>
<br>
<br>
</div>
</div>
<pre>--
Aaron Winborn
Advomatic, LLC
<a class="moz-txt-link-freetext" href="http://advomatic.com/">http://advomatic.com/</a>
Drupal Multimedia available in September!
<a class="moz-txt-link-freetext" href="http://www.packtpub.com/create-multimedia-website-with-drupal/book">http://www.packtpub.com/create-multimedia-website-with-drupal/book</a>
My blog:
<a class="moz-txt-link-freetext" href="http://aaronwinborn.com/">http://aaronwinborn.com/</a></pre>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
</div>
</div>
<font color="#888888">-- <br>
Randy Fay<br>
Drupal Development, troubleshooting, and debugging<br>
<a moz-do-not-send="true" href="mailto:randy@randyfay.com"
target="_blank" rel="nofollow" ymailto="mailto:randy@randyfay.com">randy@randyfay.com</a><br>
+1 970.462.7450<br>
<br>
</font></blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Tim Loudon<br>
VP of Technology, Abroad101<br>
(781) 686-6096<br>
<a moz-do-not-send="true" href="http://www.abroad101.com/"
target="_blank" rel="nofollow">www.abroad101.com</a><br>
</div>
</div>
</div>
</blockquote>
</body>
</html>