The PIVOT function supports the UNPIVOT syntax or TD_UNPIVOT function as a source for the PIVOT operator.
The PIVOT/ UNPIVOT operator is a single dimensional way of interchanging the data, such as converting rows to columns or columns to rows.
You can also swap both the rows and columns within a single query; for example, using UNPIVOT as the source query to PIVOT. This allows for more flexibility for two-dimensional methods of interchanging data in a table.
- Allows you to change table data two-dimensionally.
- You do not need to know the number of columns returned by UNPIVOT operator to use as PIVOT source.
For more information, see "PIVOT" in Teradata Vantage™ SQL Functions, Expressions, and Predicates, B035-1145.