【发布时间】:2020-10-05 00:24:02
【问题描述】:
我正在尝试实现这样的输出。用户在 3 个月内访问了特定页面的次数。 页面就像主页、帐户页面、购物车页面等。
我的桌子
MMDDYY Pagevisted Username No. of time Month
1/1/2019 Homepage A 1 January
2/21/2019 AccountPage A 1 February
2/25/2019 AccountPage B 5 February
3/1/2019 Homepage A 3 March
4/2/2019 cartpage B 2 April
5/2/2019 AccountPage A 1 May
6/2/2019 Submisison C 1 June
5/5/2019 Homepage D 2 May
5/2/2019 Articles E 2 May
7/25/2019 cartpage E 2 July
8/12/2019 Articles A 1 August
9/23/2019 Articles A 6 September
请您帮我查询以基于滚动的方法获取数据。 例如。如果当前月份是一月,我需要一月、二月和三月的数据 如果当前月份是二月,我需要二月,三月,四月的数据 如果当前月份是三月,我需要三月,四月,五月的数据 等等。
输出应该是:
MMDDYY Pagevisted Username No. of time[3 M rolling month]
1/1/2019 Homepage A 4 this include 1 from jan, 3 from march
2/21/2019 AccountPage A 1 Account page opened by A user from current month to next other 2 month i.e. Mar April is only once
2/25/2019 AccountPage B 5 Account page opened by B user from current month to next other 2 month i.e. Mar April is only 5 time
3/1/2019 Homepage A 3 User A in march month opened homepage 3 time, but he didn't opened in following 2 other month i.e. Mar April May
6/2/2019 Submisison C 1
5/5/2019 Homepage D 2
5/2/2019 Articles E 2
7/25/2019 cartpage E 2
8/12/2019 Articles A 7
9/23/2019 Articles A 6
【问题讨论】:
标签: sql google-bigquery