4. Elements of OpenSQL Statements : Functions : Aggregate Functions : Using Group By Clause with Aggregate Functions
 
Share this page                  
Using Group By Clause with Aggregate Functions
The group by clause allows aggregate functions to be performed on subsets of the rows in the table. The subsets are defined by the group by clause. For example, the following statement selects rows from a table of political candidates, groups the rows by party, and returns the name of each party and the average funding for the candidates in that party.
select party, avg(funding)
    from candidates
    group by party;