I have a "product" type, and a "brand" type, and create Nodereference from "product" to "brand". In the Views, I simply create one field to retrieve all terms associate with "brand", and set the type filter as "product". It reports the error below:
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 ' 38583, 38583, 38583, , 38582, 38582, , , , , 38580, 38581) ORDER BY td.weight, ' at line 1 query: SELECT tn.vid AS node_vid, td.* FROM term_data td INNER JOIN term_node tn ON td.tid = tn.tid WHERE tn.vid IN (38090, 37977, 37993, 38585, 38584, 38584, 38584, 38583, 38584, 38584, 38584, 38583, 38583, 38583, 38583, 38583, 38583, , 38583, 38583, 38583, , 38582, 38582, , , , , 38580, 38581) ORDER BY td.weight, td.name in /home/greatbre/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 83.

The error happens when there are some Nulls, " 38583, , 38582, 38582, , , , , 38580, 38581"

Comments

skyredwang’s picture

Here is another issue with Nodereference Location (I don't know if they are same problem) (The setup is the same as above, "product" nodereference "brand", and each "brand" has a location)

    * user warning: Unknown column 'node_node_data_field_brand.lid' in 'on clause' query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS nid FROM node node LEFT JOIN content_type_product node_data_field_brand ON node.vid = node_data_field_brand.vid LEFT JOIN node node_node_data_field_brand ON node_data_field_brand.field_brand_nid = node_node_data_field_brand.nid LEFT JOIN content_type_product node_data_field_self_style ON node.vid = node_data_field_self_style.vid LEFT JOIN location node_node_data_field_brand__location ON node_node_data_field_brand.lid = node_node_data_field_brand__location.lid LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid WHERE node.type in ('product') ) count_alias in /home/greatbre/public_html/sites/all/modules/views/includes/view.inc on line 697.
    * user warning: Unknown column 'node_node_data_field_brand.lid' in 'on clause' query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, node_data_field_self_style.field_self_style_value AS node_data_field_self_style_field_self_style_value, node_data_field_self_style.nid AS node_data_field_self_style_nid, node.type AS node_type, node_data_field_self_style.field_best_with_value AS node_data_field_self_style_field_best_with_value, node_data_field_self_style.field_abv_value AS node_data_field_self_style_field_abv_value, node_data_field_self_style.field_ibu_value AS node_data_field_self_style_field_ibu_value, node_data_field_self_style.field_srm_value AS node_data_field_self_style_field_srm_value, node_node_data_field_brand.title AS node_node_data_field_brand_title, node_node_data_field_brand.nid AS node_node_data_field_brand_nid, node_node_data_field_brand__location.country AS node_node_data_field_brand__location_country, GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated FROM node node LEFT JOIN content_type_product node_data_field_brand ON node.vid = node_data_field_brand.vid LEFT JOIN node node_node_data_field_brand ON node_data_field_brand.field_brand_nid = node_node_data_field_brand.nid LEFT JOIN content_type_product node_data_field_self_style ON node.vid = node_data_field_self_style.vid LEFT JOIN location node_node_data_field_brand__location ON node_node_data_field_brand.lid = node_node_data_field_brand__location.lid LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid WHERE node.type in ('product') ORDER BY node_comment_statistics_last_updated DESC LIMIT 0, 30 in /home/greatbre/public_html/sites/all/modules/views/includes/view.inc on line 723. 
merlinofchaos’s picture

If you only read one of these submission guidelines, read this one. (Then please read the rest) If your problem deals exclusively with fields or filters provided by another module (CCK, Image, VotingAPI are common) please post the issue under the queue for that module first; all modules are responsible for telling Views about their own fields. It's possible Views IS at fault, but the module maintainers are the best people to make that determination, and they can kick the issue into the Views queue with an explanation of what's wrong if that is the case.

Assuming Nodereference Taxonomy is a module (I've never heard of it, myself) then you failed to read these guidelines. If it's not a module, then I really have no idea what you're talking about, nor is there enough information here to debug this.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Unfortunately, your brief mention of user relationship doesn't really tell me what you're doing here. Views has lots and lots and lots of options; you know what you did with your view, I have no idea. You have to be very very specific.

skyredwang’s picture

Status: Postponed (maintainer needs more info) » Active

sorry for not being specific. I haven't managed reproduce this first error. But I managed to create a simple view with minimal settings to reproduce the second error (nodereference location):
I only added one relationship (nodereference) from "product" to "brand", two fields "product" title and "brand" location; One filter: Node Type = product. The rest settings are default. please let me know if you need other information.
here is the exported code:

$view = new view;
$view->name = 'debugger';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'field_brand_nid' => array(
    'label' => 'Brand',
    'required' => 0,
    'delta' => -1,
    'id' => 'field_brand_nid',
    'table' => 'node_data_field_brand',
    'field' => 'field_brand_nid',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'label' => 'Title',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'country' => array(
    'label' => 'Country',
    'style' => 'name',
    'exclude' => 0,
    'id' => 'country',
    'table' => 'location',
    'field' => 'country',
    'relationship' => 'field_brand_nid',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'product' => 'product',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'tid' => 'tid',
  ),
  'info' => array(
    'tid' => array(
      'separator' => '',
    ),
  ),
  'default' => '-1',
));

The error message is here:

user warning: Unknown column 'node_node_data_field_brand.lid' in 'on clause' query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, node_node_data_field_brand__location.country AS node_node_data_field_brand__location_country FROM node node LEFT JOIN content_type_product node_data_field_brand ON node.vid = node_data_field_brand.vid LEFT JOIN node node_node_data_field_brand ON node_data_field_brand.field_brand_nid = node_node_data_field_brand.nid LEFT JOIN location node_node_data_field_brand__location ON node_node_data_field_brand.lid = node_node_data_field_brand__location.lid WHERE node.type in ('product') LIMIT 0, 10 in /home/greatbre/public_html/sites/all/modules/views/includes/view.inc on line 723.

thanks

jeremy_a’s picture

I have also encountered this behaviour. If you use a taxonomy ID argument with a node reference relationship, you would expect the view to pick up the taxonomy categories of the node being referenced. Instead it generates this error.

merlinofchaos’s picture

The second bug you mentioned should already be fixed in dev. I believe that's #324513: If a relationship table was added more than 1 hop away from the base, SQL errors resulted.

merlinofchaos’s picture

Status: Active » Fixed

Fixed in -dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.