简体   繁体   English

BigQuery 取消嵌套多个参数

[英]BigQuery unnest multiple params

I need to unnest multiple param keys event_date , page_location , page_title , user_pseudo_id .我需要取消嵌套多个参数键event_datepage_locationpage_titleuser_pseudo_id Two of them, page_location and page_title I need to unnest and show them separately.其中两个, page_locationpage_title我需要取消嵌套并分别显示它们。 The code below just randomly shows either the location or title value, I need them in a separate row下面的代码只是随机显示位置或标题值,我需要它们在单独的行中

SELECT
 event_date, value.string_value, user_pseudo_id, 
FROM
  ` mydata.events20220909*`, 
    unnest(event_params)
WHERE
key = "page_title" OR key = "page_location"

You don't necessarily have to unnest all the event_params, with the following query, you can put any parameter in a separate column您不一定要取消所有 event_params,通过以下查询,您可以将任何参数放在单独的列中

select
  event_date,
  user_pseudo_id, 
  (select value.string_value from unnest(event_params) where key = 'page_location') as page_location,
  (select value.string_value from unnest(event_params) where key = 'page_title') as page_title
from `mydata.events_20220909*`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM