The following example assumes the star1 table exists.
Calling TD_Pivoting with Aggregation Only
SELECT * FROM TD_Pivoting ( ON star1 AS InputTable PARTITION BY country Order By state USING PartitionColumns ('country') TargetColumns ('sales', 'cogs', 'state ','rating') Accumulate('yr') Aggregation('sales:SUM','cogs:AVG','state:UNIQUE_CONCAT','rating:CONCAT') Delimiters('|') CombinedColumnSizes(64001) ) AS dt Order By country;
TD_Pivoting Output
country sales_combined cogs_combined state_combined rating_combined yr ------- -------------- ------------- -------------- --------------- -- Canada 35 0.000 BC|ON A|A|B 2001 USA 130 16.250 CA|NY A|B|A|D 2001