我正在使用来自firebase的数据与Bigquery合作。 我想得到的事件和其他变量如国家,交通等。
我可以使用此代码获取事件,但是当我尝试添加新变量“user_dim.geo_info.country”时出现错误:SELECT列表表达式引用了user_dim.geo_info.country,它既没有分组也没有聚合在[3 :3]
#standardSQL
SELECT
user_dim.geo_info.country,
event.name AS event_name,
_TABLE_SUFFIX as day,
COUNT(1) as users
FROM `project_new.app_events_*`,
UNNEST(event_dim) AS event
GROUP BY event_name, day
有人可以帮助我吗?
答案 0 :(得分:2)
您只需将其添加到GROUP BY,如下所示
#standardSQL
SELECT
user_dim.geo_info.country AS country,
event.name AS event_name,
_TABLE_SUFFIX AS day,
COUNT(1) AS users
FROM `project_new.app_events_*`,
UNNEST(event_dim) AS event
GROUP BY country, event_name, day