以下查询运行并产生16行输出(通过包装在SELECT count(*) FROM (query)
中进行验证)命中是重复记录。 hits.customDimensions在命中内重复。 customDimensions在主记录中重复。作用域聚合和WHERE作用域
SELECT
fullVisitorId,
visitId,
hits.page.pagePath,
hits.type,
FIRST(IF(customDimensions.index = 10, customDimensions.value, NULL)) WITHIN RECORD AS gacid,
FIRST(IF(hits.customDimensions.index = 11, hits.customDimensions.value, NULL)) WITHIN hits AS blogCategories
FROM
[dataset.ga_sessions_20160902]
WHERE
fullVisitorId ='55555555555'
然而
SELECT
fullVisitorId,
visitId,
hits.page.pagePath,
hits.type,
FIRST(IF(customDimensions.index = 10, customDimensions.value, NULL)) WITHIN RECORD AS gacid,
FIRST(IF(hits.customDimensions.index = 11, hits.customDimensions.value, NULL)) WITHIN hits AS blogCategories
FROM
[dataset.ga_sessions_20160902]
WHERE
fullVisitorId ='55555555555'
AND hits.type = 'PAGE'
失败
Cannot query the cross product of repeated fields customDimensions.index and hits.type.
只返回一个(不平)记录和我的包裹数量,也没有给我真正的结果?为什么两个作用域集合可以在不同的作用域上工作,但最内层作用域上的WHERE
失败?
重要的是,你可以使用标记答案左侧的勾号在投票下面标记接受的答案。请参阅http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235了解其重要性。答案投票也很重要。表决有用的答案。还有更多......当某人回答你的问题时,你可以查看该怎么做 - http://stackoverflow.com/help/someone-answers。 –