anchor.diff:  include::../test/org/apache/groovy/ginq/GinqTest.groovy[tags=ginq_grouping_12,indent=0]
   ----
   
  -////
   [source, sql]
   ----
   include::../test/org/apache/groovy/ginq/GinqTest.groovy[tags=ginq_grouping_03,indent=0]
  
positive.code: include::../test/org/apache/groovy/ginq/GinqTest.groovy[tags=ginq_aggfunction_02,indent=0]
  ----
  
  ////
  [source, groovy]
  ----
  include::../test/org/apache/groovy/ginq/GinqTest.groovy[tags=ginq_aggfunction_01,indent=0]
  ----
  ////
  
  [source, groovy]
  ----
  
negative.code: [NOTE]
  `_g` is an implicit variable for `agg` aggregate function,
  it represents the grouped `Queryable` object and its record(e.g. `r`) could reference the data source by alias(e.g. `n`)
  
  
  Also, we could apply the aggregate functions for the whole GINQ result, i.e. no `groupby` clause is needed:
  [source, groovy]
  