【发布时间】:2017-04-07 06:50:18
【问题描述】:
我想生成一个新表并使用 BigQuery 放置所有键值对,其中键作为列名,值作为它们各自的值。
例子:
**Key** **Value**
channel_title Mahendra Guru
youtube_id ugEGMG4-MdA
channel_id UCiDKcjKocimAO1tV
examId 72975611-4a5e-11e5
postId 1189e340-b08f
channel_title Ab Live
youtube_id 3TNbtTwLY0U
channel_id UCODeKM_D6JLf8jJt
examId 72975611-4a5e-11e5
postId 0c3e6590-afeb
我想把它转换成:
**channel_title youtube_id channel_id examId postId**
Mahendra Guru ugEGMG4-MdA UCiDKcjKocimAO1tV 72975611-4a5e-11e5 1189e340-b08f
Ab Live 3TNbtTwLY0U UCODeKM_D6JLf8jJt 72975611-4a5e-11e5 0c3e6590-afeb
如何使用 BigQuery 做到这一点?
【问题讨论】:
-
现在您可以拨打
fhoffa.x.pivot(),详情请看这篇帖子:medium.com/@hoffa/easy-pivot-in-bigquery-one-step-5a1f13c6c710
标签: sql google-bigquery google-cloud-platform