【发布时间】:2019-08-21 11:56:13
【问题描述】:
我有一张买东西的桌子:
player_id | date | registration_date | price
pl1 | 2019-01-21 | 2019-01-20 | 20
pl1 | 2019-01-23 | 2019-01-20 | 10
pl1 | 2019-01-24 | 2019-01-20 | 15
在“日期”上使用 groupArray 和在“价格”上使用 arrayCumSum 并使用 ArrayJoin 计算后,我得到了每天累积总和的表格:
player_id | date | registration_date | sum_price
pl1 | 2019-01-21 | 2019-01-20 | 20
pl1 | 2019-01-23 | 2019-01-20 | 30
pl1 | 2019-01-24 | 2019-01-20 | 45
但我需要添加从注册到今天的缺失日期(今天是'2019-01-25'):
player_id | date | registration_date | sum_price
pl1 | 2019-01-20 | 2019-01-20 | 0
pl1 | 2019-01-21 | 2019-01-20 | 20
pl1 | 2019-01-22 | 2019-01-20 | 20
pl1 | 2019-01-23 | 2019-01-20 | 30
pl1 | 2019-01-24 | 2019-01-20 | 45
pl1 | 2019-01-25 | 2019-01-20 | 45
我该怎么做?
【问题讨论】:
-
您也可以提供您的查询吗?
-
知道怎么做就不用问了
-
祝你在这里找到答案:D
标签: clickhouse