function Sql::addGroupBy

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::addGroupBy()
  2. 10 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::addGroupBy()
  3. 11.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::addGroupBy()

Add a simple GROUP BY clause to the query.

The caller is responsible for ensuring that the fields are fully qualified and the table is properly added.

1 call to Sql::addGroupBy()
Sql::query in core/modules/views/src/Plugin/views/query/Sql.php
Generates a query and a countquery from all of the information supplied.

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1075

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function addGroupBy($clause) {
    // Only add it if it's not already in there.
    if (!in_array($clause, $this->groupby)) {
        $this->groupby[] = $clause;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.