|
@@ -147,7 +147,7 @@ select
|
|
|
dt,channel,pitcher,stage,platform,book,
|
|
|
order_count,order_user,order_amount,first_order_count,first_order_user,first_order_amount,
|
|
|
view_count,click_count,follow_user,cost,reg_order_count,reg_order_user,reg_order_amount,reg_order_amount30,
|
|
|
- web_view_count,platform_view_count,web_order_count,total_cost,total_amount,reg_order_user2
|
|
|
+ web_view_count,platform_view_count,web_order_count,total_cost,total_amount,reg_order_user_again,reg_order_user7,reg_order_user30,reg_order_amount7
|
|
|
from
|
|
|
(select dt,channel, pitcher,stage,platform,book,cost,view_count,click_count,follow_user,web_view_count,platform_view_count,web_order_count from dw_daily_channel_cost) a
|
|
|
left outer join
|
|
@@ -155,7 +155,10 @@ from
|
|
|
sum(amount) as reg_order_amount,
|
|
|
count(distinct user_id) as reg_order_user,
|
|
|
count(1) as reg_order_count,
|
|
|
- sum(if(subtractDays(date, 30)>reg_time,0,amount)) as reg_order_amount30
|
|
|
+ sum(if(subtractDays(date, 30)>reg_time,0,amount)) as reg_order_amount30,
|
|
|
+ count(distinct if(subtractDays(date, 7)>reg_time,'',user_id))-1 reg_order_user7,
|
|
|
+ sum(if(subtractDays(date, 7)>reg_time,0,amount)) as reg_order_amount7,
|
|
|
+ count(distinct if(subtractDays(date, 30)>reg_time,'',user_id))-1 reg_order_user30
|
|
|
from order where reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel) b
|
|
|
on dt=dt2 and channel=channel2 left outer join
|
|
|
(select date as dt3,channel as channel3,
|
|
@@ -176,7 +179,7 @@ left outer join
|
|
|
on dt=dt5 and channel=channel5
|
|
|
|
|
|
left outer join (
|
|
|
-select sum(if(user_order_count>1,1,0)) reg_order_user2,channel channel6,toDate(reg_date) dt6 from (
|
|
|
+select sum(if(user_order_count>1,1,0)) reg_order_user_again,channel channel6,toDate(reg_date) dt6 from (
|
|
|
select formatDateTime(reg_time,'%Y-%m-%d') reg_date,channel,count(1) user_order_count
|
|
|
from order group by formatDateTime(reg_time,'%Y-%m-%d') ,user_id,channel
|
|
|
) x group by reg_date,channel
|
|
@@ -267,6 +270,8 @@ def dw_channel_daily_total(ymd):
|
|
|
ck.execute(f"alter table dw_channel_daily_total drop partition '{ymd}'")
|
|
|
ck.execute(sql)
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
# channel_by_account_daily('2020-12-17')
|
|
|
# dw_daily_channel_cost('2020-12-17')
|
|
@@ -280,12 +285,12 @@ if __name__ == '__main__':
|
|
|
# dm_pitcher_daily_page_total()
|
|
|
# dw_channel_daily_total('2020-12-28')
|
|
|
# exit(0)
|
|
|
- dw_daily_channel()
|
|
|
- exit(0)
|
|
|
+ # dw_daily_channel()
|
|
|
+ # exit(0)
|
|
|
for i in dt.getDateLists('2019-03-18','2021-01-05'):
|
|
|
print(i)
|
|
|
# ods_order(i)
|
|
|
# channel_info_daily(i)
|
|
|
# dw_daily_channel_cost(i)
|
|
|
# dw_order_channel_cost_sync_ck(i)
|
|
|
- dw_channel_daily_total(i)
|
|
|
+ # dw_channel_daily_total(i)
|