Transpose Clause - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

TRANSPOSE Clause

"Considerations for TRANSPOSE"
"Examples of TRANSPOSE"
The TRANSPOSE clause of the SELECT statement generates for each row of the SELECT source
table a row for each item in the transpose item list. The result table of the TRANSPOSE clause
has all the columns of the source table plus, for each transpose item list, a value column or
columns and an optional key column.
TRANSPOSE is a Neoview SQL extension.
TRANSPOSE transpose-set [transpose-set]...
[KEY BY key-colname]
transpose-set is:
transpose-item-list AS transpose-col-list
transpose-item-list is:
expression-list
| (expression-list) [,(expression-list)]...
expression-list is:
expression [,expression]...
transpose-col-list is:
colname
colname-list is:
colname [,colname]...
transpose-item-list AS transpose-col-list
specifies a transpose-set, which correlates a transpose-item-list with a
transpose-col-list. The transpose-item-list can be a list of expressions or a list
of expression lists enclosed in parentheses. The transpose-col-list can be a single
column name or a list of column names enclosed in parentheses.
For example, in the transpose-set TRANSPOSE (A,X),(B,Y),(C,Z) AS (V1,V2), the items
in the transpose-item-list are (A,X),(B,Y), and (C,Z), and the transpose-col-list
is (V1,V2). The number of expressions in each item must be the same as the number of value
columns in the column list.
In the example TRANSPOSE A,B,C AS V, the items are A,B, and C, and the value column is
V. This form can be thought of as a shorter way of writing TRANSPOSE (A),(B),(C) AS (V).
transpose-item-list
specifies a list of items. An item is a value expression or a list of value expressions enclosed
in parentheses.
expression-list
specifies a list of SQL value expressions, separated by commas. The expressions must
have compatible data types.
For example, in the transpose set TRANSPOSE A,B,C AS V, the expressions A,B, and
C have compatible data types.
(expression-list) [,(expression-list)]...
specifies a list of expressions enclosed in parentheses, followed by another list of
expressions enclosed in parentheses, and so on. The number of expressions within
| (colname-list)
TRANSPOSE Clause
329

Advertisement

Table of Contents
loading

Table of Contents