我想从google big中选择自定义维度。
但是,我不明白为什么会出现错误
SELECT MAX(IF(index=1, value, NULL)) FROM UNNEST(hits.customDimensions) AS dimension1
FROM 'atomic-life-148403.131256355.ga_sessions_*', UNNEST(hits) as hits
错误是: 错误:语法错误:[3:1]
处的意外关键字FROM答案 0 :(得分:1)
您应用的每个UNNEST
操作都对应于数据的cross-join操作。因此,您可以像这样展平数组:
SELECT
MAX(IF(index=1, value, NULL))
FROM 'atomic-life-148403.131256355.ga_sessions_*',
UNNEST(hits) as hits,
UNNEST(hits.customDimensions) AS dimension1