I exported Firebase events to BigQuery and now I'm trying to select two parameters from a certain event. Here is the query for selecting one parameter:
select event_dim.params.value.int_value as level_id
from [com_company_appname_ANDROID.app_events_20161210]
where event_dim.name = "level_replays_until_first_victory" and event_dim.params.key = "level_id"
Both parameters are int values, name of the first parameter is level_id
, and the second parameter is count
. What I would like is to show is level_id
in first column and count
in second column.
Below will work with BigQuery Standard SQL
SELECT
(SELECT params.value.int_value FROM x.params
WHERE params.key = 'level_id') AS level_id,
(SELECT params.value.int_value FROM x.params
WHERE params.key = 'count') AS count
FROM `com_company_appname_ANDROID.app_events_20161210`, UNNEST(event_dim) AS x
WHERE x.name = 'level_replays_until_first_victory'
See also Migrating from legacy SQL in case if you are stuck with Legacy SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With