SELECT * FROM pivot (
ON pivot_input
PARTITION BY sn, city, week
ORDER BY week
PartitionColumns ('sn', 'city', 'week')
PivotColumn ('attribute')
TargetColumns ('value')
) ORDER BY 1,2,3;
SELECT * FROM pivot (
ON pivot_input
PARTITION BY sn, city, week
ORDER BY week
PartitionColumns ('sn', 'city', 'week')
PivotColumn ('attribute')
TargetColumns ('value')
) ORDER BY 1,2,3;