首页 > 解决方案 > 预期输入结束,但在连接中使用 UNNEST 时获得关键字“ON”(bigQuery)

问题描述

我试图在使用 JOIN 和 UNNEST 时从这些查询中获取一些数据。

SELECT 
        name,
        p.gender as Gender, 
        c.cc.display as condition,
    FROM `bigquery-public-data.fhir_synthea.patient` AS p, UNNEST(p.name) n, UNNEST(n.given) name, UNNEST(p.address) address
    JOIN `bigquery-public-data.fhir_synthea.condition` AS c , UNNEST (c.code.coding) as cc
        ON p.id = c.id

错误出现在“ON”->语法错误:预期输入结束,但关键字 ON

如果我尝试删除“CC”并编写这样的命令

c.code.coding.display as condition

然后我收到“无法访问类型为 ARRAY<STRUCT<userSelected BOOL、版本 STRING、代码 STRING 的值的字段显示”的错误。

请告诉在使用 UNNEST & JOIN 时如何在大查询中解决这个问题。或者有没有其他方法可以做到这一点?

标签: mysqlgoogle-cloud-platformgoogle-bigquerysyntax-errorunnest

解决方案


推荐阅读