I am trying to do PIVOTING in Big query by using below query
select * from
(SELECT desc,qty,RSN_DESC FROM `TABLE`)
PIVOT(SUM(qty) FOR RSN_DESC IN ('Example1', 'Example2', 'Example3', 'Example 3','Example4','Example 5',''))
If you look closely the "Example 3" and "Example 5" we have a space in between data, like "Store Ops" (an actual example from my data). Pivot does not work for such data and it gives error as
Invalid field name "Store Ops". Fields must contain only letters, numbers, and underscores, start with a letter or underscore, and be at most 300 characters long.
Any suggestions on how can I handle this scenario?