Google Bigquery: How to convert a column to a row
Often we want to store the aggregated values in different rows (move columns to rows), in order to that, you can simply use and UNION ALL statement
Example:
SELECT event_name, event_location_1
FROM `table1` as t1
WHERE event_name IN ("event_name1","event_name2","event_name3")
union all
SELECT event_name, event_location_2
FROM `table1` as t2
WHERE t2.event_name = "event_name4"
nVector
posted on 05 Sep 20Enjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds
Post Comment