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

SQL/MX Clauses
HP NonStop SQL/MX Reference Manual540440-003
7-33
Examples of TRANSPOSE
This query shows how an item in the transpose item list can contain a list of
expressions and that the KEY BY clause is optional:
SELECT * FROM mytable
TRANSPOSE (1, A, 'abc'), (2, B, 'xyz')
AS (VALCOL1, VALCOL2, VALCOL3);
The result table of the TRANSPOSE query is:
5? e21
6? f2 1
4? d11
5? e11
6? f1 1
A B C D E F VALCOL1 VALCOL2 VALCOL3
1 10 100 d1 e1 f1 1 1 abc
1 10 100 d1 e1 f1 2 10 xyz
2 20 200 d2 e2 f2 1 2 abc
2 20 200 d2 e2 f2 2 20 xyz
KEYCOL VALCOL1 VALCOL2 (EXPR)