Pivoting Example: DefaultPivotValues | Teradata Vantage - Pivoting Example: DefaultPivotValues - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

SQL Call

SELECT * FROM Pivoting (
  ON pivot_input PARTITION BY sn,city,week
  USING
  PartitionColumns ('sn','city', 'week')
  PivotKeys ('temp','pressure')
  DefaultPivotValues ('50','1000.11')
  PivotColumn ('attribute')
  TargetColumns ('value1')
) AS dt ORDER BY 1,2,3;

Output

         sn  city            week  value1_pressure      value1_temp
-----------  --------------------  -------------------- -------------
          1  asheville          1  1020.8               32
          2  asheville          2  1021.3               32
          3  asheville          3  1021.7               34
          4  nashville          1  1021                 42
          5  nashville          2  1019.8               44
          6  brownsville        2  1019                 47
          7  brownsville        3  1019.2               46
          8  beattyville        3  1000.11              50