Hi,

When going into my workspace, I have the following php error:

[code]
user warning: Unknown column 'n.nid' in 'on clause' query: SELECT n.nid, n.uid, n.type, 0 AS cid, n.title, n.status, n.changed, s.comment_count, 1 AS node FROM min_node n LEFT JOIN min_node_comment_statistics s ON n.nid = s.nid WHERE n.uid = 1 UNION SELECT c.nid AS cnid, c.uid, "" AS type, c.cid, c.subject, c.status, c.timestamp, c.pid, 0 FROM min_node n, min_comments AS c LEFT JOIN min_node_comment_statistics s ON n.nid = s.nid WHERE c.uid = 1 ORDER BY changed DESC LIMIT 0, 50 in /homepages/23/d154239500/htdocs/min/includes/database.mysql.inc on line 124.
[/code]

I understand this SQL query, but it seems drupal does not recon the FROM min_node n statement, so for it, the table "n" does not exist.

What can I do?

Thanks

Comments

jvandyk’s picture

Please provide the version of workspace that you are using (from line 2 of the module), the platform you are running on, and the version of Apache and MySQL.

Julien PHAM’s picture

So, for the workspace module :
$Id: workspace.module,v 1.21 2005/12/12 04:25:10 jvandyk Exp $

MySQL v. 5 (don't know the exact version though).

And about apache, I don't know... My website is hosted by http://www.1and1.fr

How can I know the exact mysql and apache version?

Thanks

jvandyk’s picture

Looks like this is a problem related to new rules in the way MySQL 5 handles JOIN syntax. See the thread here and issues linked from that.

Julien PHAM’s picture

Indeed, I have done some testing, the first select query alone works, the second query does not work.
So let's work on the second query: originally it is like that:

SELECT c.nid AS cnid, c.uid, "" AS type, c.cid, c.subject, c.status, c.timestamp, c.pid, 0 FROM min_node n, min_comments AS c LEFT JOIN min_node_comment_statistics s ON n.nid = s.nid WHERE c.uid = 1 ORDER BY changed DESC LIMIT 0, 50

This query alone returns the n.nid error message.

I have tried changing the order of the tables, and so:

SELECT c.nid AS cnid, c.uid, "" AS type, c.cid, c.subject, c.status, c.timestamp, c.pid, 0 FROM min_comments AS c, min_node n LEFT JOIN min_node_comment_statistics s ON n.nid = s.nid WHERE c.uid = 1 ORDER BY changed DESC LIMIT 0, 50

And now it works.

It seems in mysql 5 (perhaps), as the select causes talks about c, we should put the c before the n... but I'm unsure of this, wonder why it does not work with the original query.

But now the problem is that I have no idea on how to fix this, and I cannot put my site online 'till this query works, I need the workspace...

jvandyk’s picture

Status: Active » Fixed

Fixed. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)