我是使用Firebase的BigQuery的初学者,我尝试按应用程序版本(device.operating_system_version)获取用户和会话组的数量。
直到现在,我的代码都可以正常工作(但没有分组依据)
SELECT
COUNT(DISTINCT user_pseudo_id) AS all_users,
(
SELECT
COUNT(user_pseudo_id)
FROM
`xxxx.analytics_xxxx.events_20191105`
WHERE
event_name = 'session_start'
) AS session,
(
SELECT
COUNT(event_name) as totalScreen
FROM
`xxxx.analytics_xxxx.events_20191105`
WHERE
event_name = 'newScreen'
) AS screenView
FROM `xxxx.analytics_xxxx.events_20191105`
结果很好:
Row | all_users | session | screenView
1 | 80 | 150 | 550
但是,当我尝试按应用程序版本分组时,用户数量是正确的,并且每个应用程序版本都不同,但是会话和screenViews的数量对于所有应用程序版本都是相同的。代码如下:
SELECT
device.operating_system_version AS os_Version,
COUNT(DISTINCT user_pseudo_id) AS all_users,
(
SELECT
COUNT(user_pseudo_id)
FROM
`xxxx.analytics_xxxx.events_20191105`
WHERE
event_name = 'session_start'
) AS session,
(
SELECT
COUNT(event_name) as totalScreen
FROM
`xxxx.analytics_xxxx.events_20191105`
WHERE
event_name = 'newScreen'
) AS screenView
FROM `xxxx.analytics_xxxx.events_20191105`
GROUP BY os_Version
结果是:
Row | os_Version | all_users | session | screenView
1 | 9 | 14 | 150 | 550
2 | 6.0.1 | 4 | 150 | 550
3 | 8.0.0 | 9 | 150 | 550
4 | 7.0 | 3 | 150 | 550
...
我不了解这种行为。就像“ Group BY”仅应用于“用户”而不应用于子查询一样。
谢谢
答案 0 :(得分:1)
JScrollPane
正是这种情况,子查询对于每个os_Version'group'返回相同的结果。
我会这样重写查询:
LineBorder