<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt;color:#c00000;"><DIV></DIV>
<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 face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy E. Wichmann, PMP</STRONG></EM></FONT></P>
<P><FONT face="arial, helvetica, sans-serif"><SPAN style="FONT-SIZE: 11pt; COLOR: #632423; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Sometimes the questions are complicated and the answers are simple. - Dr. Suess</SPAN></FONT></P>
<DIV></DIV></div></body></html>