BigQuery: flatten two repeated columns

前端 未结 2 2025
鱼传尺愫
鱼传尺愫 2021-01-14 20:13

I am currently working with a very simple table on BigQuery and each row has two repeated columns class_numbers [REPEATED INTEGER] and class_

2条回答
  •  [愿得一人]
    2021-01-14 20:56

    Using standard SQL, you can use UNNEST(...) WITH OFFSET. For example,

    SELECT
      class_number,
      class_descriptions[OFFSET(off)] AS class_description
    FROM MyTable,
      UNNEST(class_numbers) AS class_number WITH OFFSET off;
    

提交回复
热议问题