简体   繁体   English

Pivot 行到 bigquery 中的列

[英]Pivot rows to columns in bigquery

I was trying to convert rows to columns - and was not able to achieve - here is my data set - table1我试图将行转换为列 - 但无法实现 - 这是我的数据集 - table1

Zipcode  dcode dname 
009      512   Albany
009      513   springfield
008      123   place1
008      123   place1
007      345   place2
007      346   place3

I want the data to be converted as我希望将数据转换为

Zipcode dcode1 dcode2 dname1 dname2
009      512     513   Albany Springfield 
008      123           place1 
007      345     346   place2 place3

Pivoting in BigQuery is not yet supported.尚不支持在 BigQuery 中进行透视。 The BigQuery Engineering team is aware of this missing feature and is working as fast as they can and you can track their progress via this Public Issue Tracker (also known as "PIT"). BigQuery 工程团队意识到这个缺失的功能,并且正在尽可能快地工作,您可以通过这个公共问题跟踪器(也称为“PIT”)跟踪他们的进度。

No worries, the community has found some ways to achieve this.不用担心,社区已经找到了一些方法来实现这一目标。 Take a look at this interesting public blog where you will find multiple approaches and examples of each of pivot in BigQuery.看看这个有趣的公共博客,您会在 BigQuery 中找到 pivot 中每一个的多种方法和示例。 On that blog this other StackOverflow question is mentioned.在那个博客上提到了另一个StackOverflow 问题

You will see that this feature has been requested since a long time but for now we don't know exactly when to expect it and for that reason I would suggest to follow the PIT for further updates.您会看到此功能已被请求了很长时间,但现在我们不知道确切的期望时间,因此我建议关注 PIT 以获取进一步更新。

Hope this is helpful!希望这会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM