Is it possible in Big Query to perform an unstack operation such that
Name Age Height
John 27 183
Maria 32 169
to obtain
Name attr value
John Age 27
John Height 183
Maria Age 32
Maria Height 169
CodePudding user response:
You can simply UNPIVOT it.
SELECT * FROM (
SELECT 'John' Name, 27 Age, 183 Height
UNION ALL
SELECT 'Maria', 32, 169
) UNPIVOT (value FOR attr IN (Age, Height))