Commit 69a29e52 by mengdongxing

Update tkdm_base_active_payment_info.sql

parent e408b967
...@@ -15,8 +15,8 @@ select /*+mapjoin(y)*/x.deviceid, ...@@ -15,8 +15,8 @@ select /*+mapjoin(y)*/x.deviceid,
x.category_id, x.category_id,
x.isgame, x.isgame,
x.platform, x.platform,
nvl(x.first_payment_ds,y.first_payment_ds) as first_payment_ds, nvl(x.first_payment_ds,y.payment_ds) as first_payment_ds,
nvl(y.last_payment_ds,x.last_amt_payment) as last_payment_ds, nvl(y.payment_ds,x.last_amt_payment) as last_payment_ds,
x.num_payment_cnt + y.num_payment_cnt as num_payment_cnt, x.num_payment_cnt + y.num_payment_cnt as num_payment_cnt,
x.num_payment_day + y.num_payment_day as num_payment_day, x.num_payment_day + y.num_payment_day as num_payment_day,
x.amt_payment +y.amt_payment as amt_payment, x.amt_payment +y.amt_payment as amt_payment,
...@@ -53,7 +53,7 @@ from ...@@ -53,7 +53,7 @@ from
amt_payment, amt_payment,
last_amt_payment last_amt_payment
from tkdm.tkdm_base_active_payment_info from tkdm.tkdm_base_active_payment_info
where ds=date_sub('2017-02-25',1) where ds=date_sub('2017-02-25',1)
) a ) a
full join full join
...@@ -66,7 +66,7 @@ from ...@@ -66,7 +66,7 @@ from
isgame, isgame,
platform platform
from tkdm.tkdm_data_active_detial_day from tkdm.tkdm_data_active_detial_day
where ds='2017-02-25' where ds='2017-02-25'
) b on a.deviceid=b.deviceid and a.appid=b.appid ) b on a.deviceid=b.deviceid and a.appid=b.appid
) x ) x
...@@ -75,12 +75,12 @@ left join ...@@ -75,12 +75,12 @@ left join
(select deviceid, (select deviceid,
appid, appid,
to_date(ins_datetime) as ins_date, to_date(ins_datetime) as ins_date,
'2017-02-25' as first_payment_ds, '2017-02-25' as payment_ds,
'2017-02-25' as last_payment_ds,
num_payment_cnt, num_payment_cnt,
1 as num_payment_day, 1 as num_payment_day,
amt_payment amt_payment
from tkdm.tkdm_data_payment_detial_day from tkdm.tkdm_data_payment_detial_day
where ds='2017-02-25'
) y on x.deviceid=y.deviceid and x.appid=y.appid ) y on x.deviceid=y.deviceid and x.appid=y.appid
cluster by deviceid,appid cluster by deviceid,appid
...@@ -109,3 +109,4 @@ FIELDS TERMINATED BY '\t' ...@@ -109,3 +109,4 @@ FIELDS TERMINATED BY '\t'
STORED AS ORC STORED AS ORC
location 's3://reyuntkio/warehouse/tkio/tkdm.db/tkdm_base_active_payment_info' location 's3://reyuntkio/warehouse/tkio/tkdm.db/tkdm_base_active_payment_info'
; ;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment