Mixin: Grouping

Grouping

Grouping mixin.

Methods


groupBy( [GroupByExprStr])

Add GROUP BY clause (set the grouping options of the result set).
Parameters:
Name Type Argument Description
GroupByExprStr string | Array.<string> <optional>
columns to group by
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)

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