I got the following error each time when I log out from admin, then log in as another user or stay anonymously, the problem come from statistics and "popular content" set up, if I disable both in settings and blocks, the problem is gone. Once I enble it, the problem shows up again.Don't know how to fix it.
user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT(n.nid), n.title, u.uid, u.name FROM node_counter s INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node n ON s.nid = n.nid INNER JOIN users u ON n.uid = u.uid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'og_public') OR (na.gid = 0 AND na.realm = 'og_all'))) AND s.daycount '0' AND n.status = 1 ORDER BY s.daycount DESC LIMIT 0, 3 in C:\progs\web\Apache\Apache2\htdocs\Drupal\drupal-4.7.0-beta4\includes\database.mysql.inc on line 124.
Comments
Similar problem...after enabling taxonomy_access
I get the following error after enabling Taxonomy_access. If I disable it, the error goes away.
user error: Unknown column 'n.nid' in 'on clause'
query: SELECT DISTINCT(n.nid), e.event_start FROM event e INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node n ON n.nid = e.nid WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0','term_access1')) AND n.status = 1 AND ((e.event_start > 1141196400 AND e.event_start < 1143874799) OR (e.event_end > 1141196400 AND e.event_end < 1143874799) OR (e.event_start < 1141196400 AND e.event_end > 1143874799)) ORDER BY event_start in /srv/www/drupal/includes/database.mysql.inc on line 66.
I have no other node access related module enabled or installed. Would appreciate some help in understanding what the solution might be.
similar problem
Were you able to solve it, if yes please post back how you solved
because i'm getting the same error on my site. Thanks
Same problem -- new info
I'm having the same problem:
user error: Unknown column 'n.nid' in 'on clause'
query: SELECT n.nid, c.cid, c.timestamp, c.subject, u.uid, u.name FROM drupal_comments c INNER JOIN drupal_node_access na ON n.nid = na.nid INNER JOIN drupal_node n ON c.nid = n.nid INNER JOIN drupal_users u ON c.uid = u.uid WHERE ((na.gid = 1 AND na.realm = 'og_subscriber') OR (na.grant_view = 1 AND na.realm = 'og_public')) AND c.status = 0 AND n.status = 1 ORDER BY c.timestamp DESC LIMIT 0, 15
It seems the issue is really coming from mySql--if you look at the query above it references the table node in the second join, but a column from that same table in the first join. At least in my version of mySql (5.0.20), it seems the db server is can't reference the table until it has been "introduced" to it. If you test this query in MyAdmin and switch the order of the joins, it runs fast.
Unfortunately being a newbie to Drupal I have no idea where to start in constructing a patch for this--I'd have to know how this query is constructed in the first place. Is there anyone who has a resolution to this problem? Here's to stored procedures.
Chris
Problem Solved
Apparently problem is caused by new query processing rules in mySql 5. Unfortunately solution can be a bit tedious... involves finding the offending queries in their respective module files and editing them. There are other threads on this, most notably http://drupal.org/node/43735.
In my case, the trouble originated in og_block.module line 25. Original reads:
$sql = "SELECT n.nid, c.cid, c.timestamp, c.subject, u.uid, u.name FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {users} u ON c.uid = u.uid WHERE c.status = %d AND n.status = 1 ORDER BY c.timestamp DESC";
changed to:
$sql = "SELECT n.nid, c.cid, c.timestamp, c.subject, u.uid, u.name FROM {node} n INNER JOIN {comments} c ON c.nid = n.nid INNER JOIN {users} u ON c.uid = u.uid WHERE c.status = %d AND n.status = 1 ORDER BY c.timestamp DESC";
Bookmarking, still having
Bookmarking, still having this issue error:
Could may be also be the db_rewrite_sql somewhere...
greetings,
Martijn