0

I have created a view of node content and I need author name, role, and image to show with content. I have also made a relationship with the user in the advance section for the above-mentioned fields. it's working correctly but when I on Aggregation it gives this SQL query error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users_field_data_node_field_revision__user__user_picture.user_picture_' in 'field list': SELECT node_field_data.title AS node_field_data_title, users_field_data_node_field_revision.name AS users_field_data_node_field_revision_name, users_field_data_node_field_revision__user__user_picture.user_picture_ AS users_field_data_node_field_revision__user__user_picture_use, nodeviewcount.id AS id, nodeviewcount.nid AS nodeviewcount_nid, node_field_data.created AS node_field_data_created, MIN(node_field_data.nid) AS nid, MIN(users_field_data_node_field_revision.uid) AS users_field_data_node_field_revision_uid FROM {node_field_data} node_field_data INNER JOIN {node_field_revision} node_field_revision ON node_field_data.vid = node_field_revision.vid LEFT JOIN {users_field_data} users_field_data_node_field_revision ON node_field_revision.uid = users_field_data_node_field_revision.uid LEFT JOIN {user__user_picture} users_field_data_node_field_revision__user__user_picture ON users_field_data_node_field_revision.uid = users_field_data_node_field_revision__user__user_picture.entity_id AND (users_field_data_node_field_revision__user__user_picture.deleted = :views_join_condition_0 AND users_field_data_node_field_revision__user__user_picture.langcode = users_field_data_node_field_revision.langcode) LEFT JOIN {nodeviewcount} nodeviewcount ON node_field_data.nid = nodeviewcount.nid WHERE (node_field_data.status = :db_condition_placeholder_2) AND (node_field_data.type IN (:db_condition_placeholder_3)) GROUP BY node_field_data_title, users_field_data_node_field_revision_name, users_field_data_node_field_revision__user__user_picture_use, id, nodeviewcount_nid, node_field_data_created ORDER BY node_field_data_created DESC LIMIT 11 OFFSET 0; Array ( [:db_condition_placeholder_2] => 1 [:db_condition_placeholder_3] => ask_question [:views_join_condition_0] => 0 )

I don't know what is the issue and how to fix this problem. Aggregation is must for me in this view because I have to count Node ID through Aggregation.

  • As always, adding version of Drupal and/or Views is useful. – hansfn May 14 at 8:55
1

I have the same issue over aggregation but it started working for me once i applied this patch

/// PLEASE CHECK BELOW FOR PATCH

diff --git a/modules/field/views_handler_field_field.inc 

b/modules/field/views_handler_field_field.inc

index 799c9a5..e713016 100644

--- a/modules/field/views_handler_field_field.inc

+++ b/modules/field/views_handler_field_field.inc


@@ -770,7 +770,7 @@ class views_handler_field_field extends views_handler_field 

{

    * Return an array of items for the field.

    */

   function set_items($values, $row_id) {

-    if (empty($values->_field_data[$this->field_alias]) || empty($values-

>_field_data[$this->field_alias]['entity'])) {

+    if (empty($values->_field_data[$this->field_alias]) || empty($values-

>_field_data[$this->field_alias]['entity']) || !isset($values-

>_field_data[$this->field_alias]['entity']->{$this->definition['field_name']})) {
       return array();
     }
  • Please edit your answer and paste the patch as code. It's completely broken as is. And if the patch is from a drupal.org issue, please provide a link. – hansfn May 14 at 8:56
  • Thanks, you solved my issue. – Shakil Ahmad May 14 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.