Mixin: Grouping

Grouping

Grouping mixin.
Source:

Methods

groupBy(GroupByExprStropt) → {Grouping}

Add GROUP BY clause (set the grouping options of the result set).
Parameters:
Name Type Attributes Description
GroupByExprStr string | Array.<string> <optional>
columns to group by
Source:
Throws:
When an expression is invalid.
Type
Error
Returns:
The query instance.
Type
Grouping
Example
// arguments as columns group by
const query = table.select('foo', 'bar').groupBy('foo asc', 'bar desc')

// array of columns to group by
const query = table.select('foo', 'bar').groupBy(['foo asc', 'bar desc'])

having(expr) → {Grouping}

Add HAVING clause.
Parameters:
Name Type Description
expr SearchConditionStr filtering criteria
Source:
Returns:
The query instance.
Type
Grouping