我有以下SQL语句,简而言之,table
包含我需要获取过去一年网站行为的id
列表。这些id
应与customDimensions.value
SELECT fullVisitorId, visitNumber, totals.pageviews, customDimensions.value as client_id
FROM (
SELECT * FROM
TABLE_DATE_RANGE([xxxxxxx.ga_sessions_],
TIMESTAMP('2017-01-01'),
TIMESTAMP('2018-01-01'))
)
WHERE customDimensions.index = 2 AND customDimensions.value IN (SELECT STRING(id) FROM [table])
GROUP BY 1,2,3,4
我收到错误:
错误:无法加入重复字段customDimensions.value
答案 0 :(得分:1)
我发现你仍然使用BigQuery Legacy SQL,所以下面是遗留sql
假设原始查询的其余部分符合您的要求 - 它会解决以下错误
错误:无法加入重复字段customDimensions.value
#legacySQL
SELECT fullVisitorId, visitNumber, totals.pageviews, customDimensions.value AS client_id
FROM FLATTEN((
SELECT * FROM
TABLE_DATE_RANGE([xxxxxxx.ga_sessions_],
TIMESTAMP('2017-01-01'),
TIMESTAMP('2018-01-01'))
), customDimensions)
WHERE customDimensions.index = 2 AND customDimensions.value IN (SELECT STRING(id) FROM [table])
GROUP BY 1,2,3,4