{"id":843,"date":"2022-08-30T15:08:06","date_gmt":"2022-08-30T15:08:06","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/problem-with-views-7-x-3-0-column-not-found-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:08:06","modified_gmt":"2022-08-30T15:08:06","slug":"problem-with-views-7-x-3-0-column-not-found-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-with-views-7-x-3-0-column-not-found-collection-of-common-programming-errors\/","title":{"rendered":"Problem with Views 7.x-3.0 &#8211; Column not found-Collection of common programming errors"},"content":{"rendered":"<p>I just updated the views from 7.x-3.0-rc1 to version 7.x-3.0 and now I&#8217;m getting the following error when executing my view:<\/p>\n<p><code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_category.nid' in 'on clause'<\/code><\/p>\n<p>The generated query looks like this:<\/p>\n<pre><code>SELECT node.title AS node_title, \n       node.nid AS nid, \n       node_field_data_field_category.title AS node_field_data_field_category_title,\n      'node' AS field_data_field_color_node_entity_type, \n      'node' AS field_data_field_image_node_entity_type, \n      'node' AS field_data_field_sale_node_entity_type\nFROM {node} node\nLEFT JOIN {field_data_field_category} field_data_field_category ON node.nid = \n                                      field_data_field_category.entity_id AND \n                                      (field_data_field_category.entity_type = 'node' AND \n                                      field_data_field_category.deleted = '0')\nLEFT JOIN {node} node_field_data_field_category ON field_data_field_category.nid = \n                 node_field_data_field_category.nid\nLEFT JOIN {field_data_field_gender} field_data_field_gender ON node.nid = \n                                    field_data_field_gender.entity_id AND\n                                    (field_data_field_gender.entity_type = 'node' AND\n                                    field_data_field_gender.deleted = '0')\nWHERE (((node.type IN  ('product')) AND (node.status = '1') AND\n        (field_data_field_gender.field_gender_value IN  ('0', '1'))));\n<\/code><\/pre>\n<p>I see that the <code>field_data_field_category.nid<\/code> should be <code>field_data_field_category.field_category_nid<\/code>, but how do I solve this without using something like <code>hook_query_alter<\/code>?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:48:29. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I just updated the views from 7.x-3.0-rc1 to version 7.x-3.0 and now I&#8217;m getting the following error when executing my view: SQLSTATE[42S22]: Column not found: 1054 Unknown column &#8216;field_data_field_category.nid&#8217; in &#8216;on clause&#8217; The generated query looks like this: SELECT node.title AS node_title, node.nid AS nid, node_field_data_field_category.title AS node_field_data_field_category_title, &#8216;node&#8217; AS field_data_field_color_node_entity_type, &#8216;node&#8217; AS field_data_field_image_node_entity_type, &#8216;node&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-843","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=843"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/843\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}