我正在努力获得qulifiedVisitor计数.qulifiedVisitor将是在网站上搜索"apple"的用户.
但我收到此错误:
Cannot access filed page on a value with type ARRAY<STRUCT<hitNumber INT64,timeITN64, time64,..>>
Run Code Online (Sandbox Code Playgroud)
我尝试过其他人之前提供的方法,例如使用UNNEST(命中)或exists().但是,它仍然无法正常工作.
如果您有任何想法,请告诉我.
我使用相同的逻辑来取消hit.eCommerceAction,但它不像其他字段那样工作.有关这个问题的任何帮助?另外,max(if())函数是否是用于获取两个hits.customeDimenison.value的正确函数?
SELECT
Date
,COUNT(DISTINCT FULLVISITORID)
, product.v2ProductCategory
,max(if(customDimensions.index=2, customDimensions.value,null)) as dest
,max(if(customDimensions.index=21, customDimensions.value,null)) as pax
,eCommerceAction.action_type
,product.v2ProductName
FROM `table` as t
CROSS JOIN UNNEST(hits) AS hit
CROSS JOIN UNNEST(hit.customDimensions) AS customDimensions
CROSS JOIN UNNEST(hit.eCommerceAction) as eCommerceAction
CROSS JOIN UNNEST(hit.product) AS product
GROUP BY
Date
,product.v2ProductCategory
,eCommerceAction.action_type
,product.v2ProductName
Run Code Online (Sandbox Code Playgroud)
我得到的错误代码是错误:UNNEST中引用的值必须是数组.UNNEST包含STRUCT类型的表达式
有谁知道如何同时使用多个FLATTEN函数和Table_date_range?现在我只能获得一天的数据,但我希望获得所有可用的数据.有办法吗?
select
Date,COUNT(DISTINCT FULLVISITORID),hits.product.v2ProductCategory
FROM FLATTEN((FLATTEN (table, hits.product.v2ProductCategory)) ,customDimensions.value)
group by Date
,hits.product.v2ProductCategory
Run Code Online (Sandbox Code Playgroud)
谢谢