我有非常简单的遗留sql结构
SELECT
report_date,
campaign.bundleId,
campaign.countryCode,
campaign.stageNum
FROM
[...records_20200708],
[...records_20200707]
我试着把它转换成标准sql
SELECT
report_date,
(select bundleId from unnest(campaign)) as campaign_bundleId,
(select countryCode from unnest(campaign)) as campaign_countryCode,
(select stageNum from unnest(campaign)) as campaign_stageNum
FROM
`...records_*`
它不起作用。我得到一个错误: Scalar subquery produced more than one element
. 我哪里错了,怎么纠正?
1条答案
按热度按时间3yhwsihp1#
下面是bigquery标准sql来处理您收到的错误消息
Scalar subquery produced more than one element
-只需添加ARRAY
所以bq知道如何处理这些more than one element
输入输出或者,取决于预期的输出-您可以使用下面的