HP Neoview SQL Reference Manual page 333

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

The result table of the TRANSPOSE query is:
KEYCOL
1
2
3
1
2
3
This query shows how to use COUNT applied to VALCOL. The result table of the
TRANSPOSE query shows the number of distinct values in VALCOL.
SELECT COUNT(DISTINCT VALCOL) FROM mytable
TRANSPOSE A, B, C AS VALCOL
KEY BY KEYCOL
GROUP BY KEYCOL;
(EXPR)
--------------------
--- 3 row(s) selected.
This query shows how multiple TRANSPOSE clauses can be used in the same query. The
result table from this query has nine times as many rows as there are rows in MYTABLE:
SELECT KEYCOL1, VALCOL1, KEYCOL2, VALCOL2 FROM mytable
TRANSPOSE A, B, C AS VALCOL1
KEY BY KEYCOL1
TRANSPOSE D, E, F AS VALCOL2
KEY BY KEYCOL2;
The result table of the TRANSPOSE query is:
KEYCOL1
1
1
1
2
2
2
3
3
3
1
1
1
2
2
VALCOL
1
10
100
2
20
200
2
2
2
VALCOL1
1
1
1
10
10
10
100
100
100
2
2
2
20
20
D
d1
d1
d1
d2
d2
d2
KEYCOL2
1
2
3
1
2
3
1
2
3
1
2
3
1
2
COUNT(*)
1
1
1
1
1
1
VALCOL2
d1
e1
f1
d1
e1
f1
d1
e1
f1
d2
e2
f2
d2
e2
TRANSPOSE Clause
333

Advertisement

Table of Contents
loading

Table of Contents