MYDB.SCHEMA(USER)=> SELECT max(temp_lo) FROM weather;
MAX
-----
55
As shown in this example, the grouped aggregates provide a summary (in this case, the maximum value) of a set of rows, but they do not preserve any detail of the information. They return group column and aggregate values.
MYDB.SCHEMA(USER)=> SELECT city, max(temp_lo) FROM weather GROUP BY city;
CITY | MAX
---------------+-----
San Francisco | 55
Boston | 40
(2 rows)
MYDB.SCHEMA(USER)=> SELECT city, max(temp_lo) FROM weather GROUP BY city
HAVING max(temp_lo) < 42;
CITY | MAX
--------+-----
Boston | 40
(1 row)
MYDB.SCHEMA(USER)=> SELECT city FROM weather WHERE temp_lo = (SELECT
max(temp_lo) FROM weather);
CITY
---------------
San Francisco
(1 row)
For more information about the available aggregate functions, see Aggregate functions.
Netezza® supports the enhanced SQL GROUP BY clause syntax of rollup, cube, and grouping set for user tables.
SELECT percentile_disc (10) WITHIN GROUP ( order by col1_Srno) FROM
advanced_analytic_1 GROUP BY CUBE(col1_int1,col1_int2);
ERROR: CUBE, ROLLUP, GROUPING SETS, GROUPING not permitted with WITHIN
GROUP