GROUP BY clause
The GROUP BY clause specifies how retrieved rows are grouped for aggregate functions. For example,
SELECT PART_NO, SUM(QUANTITY) AS PQTY ;
FROM PARTS ;
GROUP BY PART_NO
Aggregates in the SELECT clause must have a GROUP BY clause if a projected field is used, as shown in the example above.