Querying multiple repeated fields in BigQuery

后端 未结 3 932
有刺的猬
有刺的猬 2020-12-28 20:56

I have a schema that contains multiple repeated fields which are not nested.

I\'m trying to query the cross product, but I get an error: \"Cannot query the cross pr

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-28 21:41

    You can use a nested subselect inside the FLATTEN. It requires an extra paren around the select statement. (the syntax is kind of ugly, unfortunately). e.g.

    SELECT
      ...
    FROM (
        FLATTEN((
          SELECT
            ...
          FROM (
              FLATTEN((
                SELECT
                  ...
                FROM
                  table),
                f1)
              )
            ),
          f2)
        )
      )
    

提交回复
热议问题