SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-188
SELECT Statement
GROUP BY clause, if one exists, must precede the HAVING clause in the SELECT
statement.
To comply with ANSI standards, NonStop SQL/MX does not move aggregate
predicates from the WHERE clause to a HAVING clause and does not move
non-aggregate predicates from the HAVING clause to the WHERE clause, as
NonStop SQL/MP does.
If there is no GROUP BY clause, the search-condition is applied to the entire
table (which consists of one group) resulting from the WHERE clause (or the
FROM clause if there is no WHERE clause).
In search-condition, you can specify any column as the argument of an
aggregate (or set) function; for example, AVG (SALARY). An aggregate function is
applied to each group in the grouped table.
A column that is not an argument of an aggregate function must be a grouping
column. When you refer to a grouping column, you are referring to a single value
because each row in the group contains the same value in the grouping column.
See Search Condition on page 6-102.
HAVING rowset-search-condition
specifies a rowset search condition to apply to each group of the grouped table
resulting from the preceding GROUP BY clause in the SELECT statement. The
individual search conditions in the rowset-search-condition array are
successively applied to each group. The GROUP BY clause, if one exists, must
precede the HAVING clause in the SELECT statement. If there is no GROUP BY
clause, rowset-search-condition is applied to the entire table (which
consists of one group) resulting from the WHERE clause (or the FROM clause if
there is no WHERE clause).
You can specify any column as the argument of an aggregate (or set) function; for
example, AVG (SALARY). An aggregate function is applied to each group in the
grouped table. A column that is not an argument of an aggregate function must be
a grouping column. When you refer to a grouping column, you are referring to a
single value because each row in the group contains the same value in the
grouping column.
See Rowset Search Condition on page 6-104.
[FOR] access-option ACCESS
specifies the access-option when accessing data specified by the SELECT
statement or by a table reference in the FROM clause derived from the evaluation
of a query expression that is a SELECT statement. See Data Consistency and
Access Options on page 1-7.
Embed