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

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-187
SELECT Statement
TRANSPOSE is an SQL/MX extension. See TRANSPOSE Clause on page 7-25.
SEQUENCE BY colname [ASC[ENDING] | DESC[ENDING]]
[,colname [ASC[ENDING] | DESC[ENDING]]]...
specifies the order in which to sort the rows of the intermediate result table for
calculating sequence functions. You must include a SEQUENCE BY clause if you
include a sequence function in select-list. Otherwise, NonStop SQL/MX
returns an error. Further, you cannot include a SEQUENCE BY clause if there is no
sequence function in select-list.
colname
names a column in select-list or a column in a table reference in the
FROM clause of the SELECT statement. colname is optionally qualified by a
table, view, or correlation name; for example, CUSTOMER.CITY.
ASC | DESC
specifies the sort order. The default is ASC. When NonStop SQL/MX orders an
intermediate result table on a column that can contain null, nulls are
considered equal to one another but greater than all other nonnull values.
GROUP BY colname [,colname]...
specifies grouping columns colname [,colname]... that define a set of groups
for the result table of the SELECT statement. These columns must appear in the
list of columns in the table references in the FROM clause of the SELECT
statement.
If you include a GROUP BY clause, the columns you refer to in the select-list
must be either grouping columns or arguments of an aggregate (or set) function.
The grouping columns define a set of groups in which each group consists of rows
with identical values in the specified columns. The column names can be qualified
by a table or view name or a correlation name; for example, CUSTOMER.CITY.
For example, if you specify AGE, the result table contains one group of rows with
AGE equal to 40 and one group of rows with AGE equal to 50. If you specify AGE
and then JOB, the result table contains one group for each age and, within each
age group, subgroups for each job code.
For grouping purposes, all nulls are considered equal to one another. The result
table of a GROUP BY clause can have only one null group.
See Considerations for GROUP BY on page 2-195.
HAVING search-condition
specifies a search-condition to apply to each group of the grouped table
resulting from the preceding GROUP BY clause in the SELECT statement. The