|
@@ -204,10 +204,10 @@ select '{dt.get_n_days(-1)}' dt,
|
|
channel_count-on_channel_count off_channel_count,
|
|
channel_count-on_channel_count off_channel_count,
|
|
round(this_month_cost,2),
|
|
round(this_month_cost,2),
|
|
round(this_month_amount,2),
|
|
round(this_month_amount,2),
|
|
- round(this_month_roi,4),
|
|
|
|
|
|
+ if(this_month_cost = 0, 0, round(this_month_amount / this_month_cost, 4)) this_month_roi,
|
|
last_month_cost,
|
|
last_month_cost,
|
|
last_month_amount,
|
|
last_month_amount,
|
|
- if(last_month_cost = 0, 0, last_month_new_user_amount / last_month_cost) last_month_roi,
|
|
|
|
|
|
+ if(last_month_cost = 0, 0, last_month_amount / last_month_cost) last_month_roi,
|
|
round(last_month_far_amount,2),
|
|
round(last_month_far_amount,2),
|
|
follow_user,
|
|
follow_user,
|
|
if(last_month_cost = 0, 0, last_month_far_amount / last_month_cost) last_month_far_roi
|
|
if(last_month_cost = 0, 0, last_month_far_amount / last_month_cost) last_month_far_roi
|
|
@@ -233,9 +233,7 @@ from (select pitcher,
|
|
on q.pitcher = e.pitcher
|
|
on q.pitcher = e.pitcher
|
|
left outer join (
|
|
left outer join (
|
|
select pitcher,
|
|
select pitcher,
|
|
- sum(cost) this_month_cost,
|
|
|
|
- sum(order_amount) this_month_amount,
|
|
|
|
- if(this_month_cost = 0, 0, round(this_month_amount / this_month_cost, 4)) this_month_roi
|
|
|
|
|
|
+ sum(cost) this_month_cost
|
|
from dw_daily_channel
|
|
from dw_daily_channel
|
|
where dt >= '{dt.get_n_pre_month_first_day(0)}'
|
|
where dt >= '{dt.get_n_pre_month_first_day(0)}'
|
|
group by pitcher) r
|
|
group by pitcher) r
|
|
@@ -255,19 +253,20 @@ from (select pitcher,
|
|
group by pitcher
|
|
group by pitcher
|
|
) y on q.pitcher = y.pitcher
|
|
) y on q.pitcher = y.pitcher
|
|
left outer join (
|
|
left outer join (
|
|
- select b.pitcher, sum(amount) last_month_new_user_amount
|
|
|
|
|
|
+ select b.pitcher, sum(amount) last_month_amount
|
|
from order a
|
|
from order a
|
|
left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
|
|
left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
|
|
where reg_time >= '{dt.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{dt.get_n_pre_month_first_day(0)} 00:00:00'
|
|
where reg_time >= '{dt.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{dt.get_n_pre_month_first_day(0)} 00:00:00'
|
|
and dt<'{dt.get_n_pre_month_first_day(0)}'
|
|
and dt<'{dt.get_n_pre_month_first_day(0)}'
|
|
group by pitcher
|
|
group by pitcher
|
|
) p on q.pitcher=p.pitcher
|
|
) p on q.pitcher=p.pitcher
|
|
-left outer join
|
|
|
|
-(
|
|
|
|
- select pitcher, sum(order_amount) last_month_amount
|
|
|
|
- from dw_daily_channel where
|
|
|
|
- dt >= '{dt.get_n_pre_month_first_day(1)}' and dt<'{dt.get_n_pre_month_first_day(0)}' group by pitcher
|
|
|
|
-)k on q.pitcher=k.pitcher
|
|
|
|
|
|
+left outer join (
|
|
|
|
+ select b.pitcher, sum(amount) this_month_amount
|
|
|
|
+ from order a
|
|
|
|
+ left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
|
|
|
|
+ where reg_time >= '{dt.get_n_pre_month_first_day(0)} 00:00:00'
|
|
|
|
+ group by pitcher
|
|
|
|
+) g on q.pitcher=g.pitcher
|
|
|
|
|
|
|
|
|
|
having pitcher != ''"""
|
|
having pitcher != ''"""
|
|
@@ -301,12 +300,13 @@ if __name__ == '__main__':
|
|
# dm_pitcher_daily_page_total()
|
|
# dm_pitcher_daily_page_total()
|
|
dm_pitcher_daily_page_total()
|
|
dm_pitcher_daily_page_total()
|
|
# dw_channel_daily_total('2020-12-28')
|
|
# dw_channel_daily_total('2020-12-28')
|
|
- # exit(0)
|
|
|
|
- # dw_daily_channel()
|
|
|
|
exit(0)
|
|
exit(0)
|
|
- for i in dt.getDateLists('2019-03-18','2021-01-05'):
|
|
|
|
- print(i)
|
|
|
|
- # ods_order(i)
|
|
|
|
|
|
+ # dw_daily_channel()
|
|
|
|
+ # # exit(0)
|
|
|
|
+ # for i in dt.getDateLists('2019-03-18','2021-01-05'):
|
|
|
|
+ # print(i)
|
|
|
|
+ # order_sync_ck(today)
|
|
|
|
+ # # ods_order(i)
|
|
# channel_info_daily(i)
|
|
# channel_info_daily(i)
|
|
# dw_daily_channel_cost(i)
|
|
# dw_daily_channel_cost(i)
|
|
# dw_order_channel_cost_sync_ck(i)
|
|
# dw_order_channel_cost_sync_ck(i)
|