<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>This is a real head scratcher.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have two sites: mysite.com and it.mysite.com, the 
Italian version.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I noticed this morning a ton of mysql errors on 
pages where I have a block called "Related Pages". The sql query for this block 
is:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>SELECT n.title, n.nid FROM {node} n INNER JOIN 
{term_node} tn ON n.nid = tn.nid WHERE tn.tid = $term-&gt;tid AND n.nid != $nid 
LIMIT 3</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>it gets me a list of 3 related pages that share the 
same taxonomy terms and was working perfectly about 4 days ago the last time I 
checked. Now it gives me the error:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>user warning: You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 
'DISTINCT(n.nid) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid WHERE 
tn.t' at line 1 query: SELECT n.title, DISTINCT(n.nid) FROM node n INNER JOIN 
term_node tn ON n.nid = tn.nid WHERE tn.tid = 59 AND n.nid != 200 LIMIT 3 in 
/home/mysite/public_html/includes/database.mysql.inc on line 172.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I pasted the code into phpmyadmin and then noticed 
the difference between this and what I was getting on the Italian site which has 
identical code. For some reason, the DISTINCT was getting put into the code. 
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>So in block config, the code has been pasted 
as:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>SELECT n.title, n.nid FROM {node} n INNER JOIN 
{term_node} tn ON n.nid = tn.nid WHERE tn.tid = $term-&gt;tid AND n.nid != $nid 
LIMIT 3</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and yet the query is being sent as:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>SELECT n.title, DISTINCT(n.nid) FROM node n INNER JOIN term_node tn ON 
n.nid = tn.nid WHERE tn.tid = 59 AND n.nid != 200 LIMIT 3</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and it is this which is causing an error. In 
phpmyadmin, when I take away the DISTINCT(), it works like a dream.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>this is not happening on the Italian site despite 
identical block code. Now, I have been doing quite a bit of work with phpmyadmin 
in last few days although I can't think of anything I've changed on the english 
DB that may have created this result.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Do I have to start calling the mediums and reaching 
for the garlic and crucifix?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Neil</FONT></DIV></BODY></HTML>