I'm relearning views with D8 and am converting some old D6 views. I've created a view with "Grouping field" set in "Style options", but the SQL generated doesn't include any GROUP BY field.

The field in question is a date, which I am custom formatting as "Y" and have ticked "Use rendered output to group rows".

The SQL generated is:

SELECT node_field_data.langcode AS node_field_data_langcode, node_field_data.title AS node_field_data_title, node_field_data.nid AS nid, DATE_FORMAT(node__field_publication_date.field_publication_date_value, '%Y') AS node__field_publication_date_field_publication_date_value_ye
{node_field_data} node_field_data
INNER JOIN {node__library_type} node__library_type ON node_field_data.nid = node__library_type.entity_id AND (node__library_type.deleted = '0' AND node__library_type.langcode = node_field_data.langcode)
LEFT JOIN {node__field_publication_date} node__field_publication_date ON node_field_data.nid = node__field_publication_date.entity_id AND (node__field_publication_date.deleted = '0' AND node__field_publication_date.langcode = node_field_data.langcode)
WHERE (( (node__library_type.library_type_target_id = '1937') )AND(( (node_field_data.status = 1 OR (node_field_data.uid = 1 AND 1 <> 0 AND 1 = 1) OR 1 = 1) AND (node_field_data.type IN  ('library')) )))
ORDER BY node__field_publication_date_field_publication_date_value_ye DESC, node_field_data_title ASC

Is this because I'm using "Fields" mode to display?

  • 1
    This may or may not be the cause: drupal.org/node/2369119
    – mpdonadio
    Commented Jul 1, 2016 at 13:06
  • 1
    It may be that Group By field operates via rendering and not on the query level. To get the Group By you can add Aggregate option. And the output is correct, you just don;t see the Group By clause, correct? Commented Jul 1, 2016 at 16:52
  • @J.Reynolds the default twig template isn't showing anything but maybe it's a problem there rather than the Virews module - will check it out!
    – Nic
    Commented Jul 1, 2016 at 16:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.