Hi All,

Is it possible my View just corrupted in my DB?

I had a view that worked great. But then it stopped working. I also have SQL errors in my logs and This is broken on my site and my localhost dev site.

If I load a previous database it works and the views display settings look the same... Unfortunately this is an old backup and I don't want to restore it.

I did upload updates on a few modules. Sitemap, Date, and image without incident I thought... I don't think this should have affected views.

Weird.. I don't see the problem with the SQL

Here's the Log Error
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(node.nid), node.title AS node_title, node.created AS node_created' at line 1 query: SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.title AS node_title, node.created AS node_created, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format FROM node node LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE node.status <> 0 OR (node.uid = 1 AND 1 <> 0) OR 1 = 1 ORDER BY node_created ASC LIMIT 0, 12 in C:\xampp\htdocs\vhi-mosso\sites\all\modules\views\includes\view.inc on line 755

Comments

fidot’s picture

Well, I don't know what creates the above code but the syntax is incorrect, which is what the error says.

The SQL statement should be SELECT DISTINCT(node.nid) AS node_nid,........

It may be related to http://drupal.org/node/284392.

Hope that helps
Terry

nvisioncurtis’s picture

Fidot I think you nailed it! Thanks so much I would never have thought to look for this. The post mentions in its body noty selecting distinct and to use a filter instead. I do that anyway.

What I did to fix was to set the "Distinct" option in the view display to no from yes. This seems to be what was creating the error. I have no idea why this work initially for some weeks but it stopped working just the same.

So the question now is, should I report this as a VIEW bug?