GroupBy

public class GroupBy: Query, HavingRouter, OrderByRouter

A GroupBy represents a query GROUP BY statement to group the query result. The GROUP BY statement is normally used with aggregate functions (AVG, COUNT, MAX, MIN, SUM) to aggregate the group of the values.

  • Create and chain a HAVING component for filtering the aggregated values from the the GROUP BY clause.

    Declaration

    Swift

    public func having(_ expression: Expression) -> Having
  • Create and chain an ORDER BY component for specifying the orderings of the query result.

    Declaration

    Swift

    public func orderBy(_ orderings: Ordering...) -> OrderBy