相关疑难解决方法(0)

在BigQuery中将行转换为列(Pivot实现)

我想生成一个新表,并使用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
Run Code Online (Sandbox Code Playgroud)

我想将其转换为:

**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
Run Code Online (Sandbox Code Playgroud)

如何使用BigQuery做到这一点?

sql google-bigquery google-cloud-platform

12
推荐指数
1
解决办法
1万
查看次数