将BigQuery的Pagepath变成列

问题描述 投票:0回答:1

在bigquery中,我们有来自google analytics的数据,我们有一列名为hit.pagepath.It's like which pages visited by user in 1 session.Is there any anyway I can translate this row into column?like if user A visited to page x,y,zI want this pages data into 2 columns First Page and Next Page.Client_ID First_Page Next_PageA x yA y z。

sql google-bigquery transform
1个回答
0
投票

你可以使用 lead():

select t.*,
       lead(hits.pagepath) over (partition by client_id, session order by <visit order>) as next_pagepath
from t;

负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: 负责人: order by 应该使用指定排序的列,大概是时间戳或类似的东西。

© www.soinside.com 2019 - 2024. All rights reserved.