The following example assumes the titanic dataset table exists.
Calling TD_Pivoting with PivotColumn
SELECT * FROM TD_Pivoting (
ON titanic_dataset_unpivoted AS InputTable PARTITION BY passenger
USING
PartitionColumns ('passenger')
TargetColumns ('AttributeValue')
Accumulate ('survived')
PivotColumn('AttributeName')
PivotKeys('pclass','sex')
) AS dt Order By passenger;
TD_Pivoting Output
passenger AttributeValue_pclass AttributeValue_gender survived --------- --------------------- --------------------- -------- 2 1 female 1 4 1 female 1 7 1 male 0 10 2 female 1 16 2 female 1 21 2 male 0 40 3 female 1 61 3 male 0 1000 3 ? 1