Neoview SQL Reference Manual (R2.4)

VALCOL2KEYCOL2VALCOL1KEYCOL1
f23202
d212003
e222003
f232003
This query shows how a TRANSPOSE clause can contain multiple transpose sets—that is,
multiple transpose-item-list AS transpose-col-list. The expressions A, B, and
C are of type integer, and expressions D, E, and F are of type character.
SELECT KEYCOL, VALCOL1, VALCOL2 FROM mytable
TRANSPOSE A, B, C AS VALCOL1
D, E, F AS VALCOL2
KEY BY KEYCOL;
The result table of the TRANSPOSE query is:
VALCOL2VALCOL1KEYCOL
?11
?102
?1003
d1?4
e1?5
f1?6
?21
?202
?2003
d2?4
e2?5
f2?6
A question mark (?) in a value column indicates no value for the given KEYCOL.
This query shows how the preceding query can include a GROUP BY clause:
SELECT KEYCOL, VALCOL1, VALCOL2, COUNT(*) FROM mytable
TRANSPOSE A, B, C AS VALCOL1
D, E, F AS VALCOL2
KEY BY KEYCOL
GROUP BY KEYCOL, VALCOL1, VALCOL2;
The result table of the TRANSPOSE query is:
(EXPR)VALCOL2VALCOL1KEYCOL
1?11
1?102
1?1003
1?21
1?202
1?2003
1d2?4
314 SQL Clauses