|
@@ -207,7 +207,7 @@ select '{dt.get_n_days(-1)}' dt,
|
|
|
round(this_month_roi,4),
|
|
|
last_month_cost,
|
|
|
last_month_amount,
|
|
|
- if(last_month_cost = 0, 0, last_month_amount / last_month_cost) last_month_roi,
|
|
|
+ if(last_month_cost = 0, 0, last_month_new_user_amount / last_month_cost) last_month_roi,
|
|
|
round(last_month_far_amount,2),
|
|
|
follow_user,
|
|
|
if(last_month_cost = 0, 0, last_month_far_amount / last_month_cost) last_month_far_roi
|
|
@@ -255,13 +255,20 @@ from (select pitcher,
|
|
|
group by pitcher
|
|
|
) y on q.pitcher = y.pitcher
|
|
|
left outer join (
|
|
|
- select b.pitcher, sum(amount) last_month_amount
|
|
|
+ select b.pitcher, sum(amount) last_month_new_user_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(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)}'
|
|
|
group by 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
|
|
|
+
|
|
|
|
|
|
having pitcher != ''"""
|
|
|
print(sql)
|