Commit 1fbbd22c authored by yindanlei's avatar yindanlei

add fangan_day report codes

parent 9d976098
......@@ -80,8 +80,7 @@ FROM
SELECT device_id
,concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
FROM online.ml_device_day_active_status
WHERE partition_date >= '20200724'
and partition_date <= regexp_replace(date_sub(current_date(),1),'-','')
WHERE partition_date>='20200724' AND partition_date<=regexp_replace(date_sub(current_date(),1),'-','')
)t
on t1.device_id = t.device_id
GROUP BY t1.partition_date,t1.device_id,device_type,grey_type,device_os_type,channel_type
......@@ -146,7 +145,7 @@ LEFT JOIN
,1 AS consult_num
FROM online.AL_COMMUNITY_USER_VALID_CONSULT_DAY
WHERE
partition_date between '20200724' AND regexp_replace(date_sub(current_date(),1),'-','')
partition_date between '20200701' AND regexp_replace(date_sub(current_date(),1),'-','')
AND is_valid_consult='true'
AND merchant_id IS NOT NULL
GROUP BY user_id,merchant_id,substr(partition_date,1,6)
......@@ -162,7 +161,7 @@ LEFT JOIN
FROM ONLINE.ML_TRADE_ORDER_DETAIL_DAY T
WHERE
T.PARTITION_DATE = regexp_replace(date_sub(current_date(),1),'-','')
AND T.PAY_DATE between '2020-07-24' AND date_sub(current_date(),1)
AND T.PAY_DATE between '2020-07-01' AND date_sub(current_date(),1)
AND T.is_pure_user='true'
GROUP BY T.USER_ID,T.merchant_id,regexp_replace(SUBSTR(T.PAY_DATE,1,7),'-','')
) T4
......@@ -180,7 +179,7 @@ LEFT JOIN
SELECT sub_id,REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '') as partition_date
FROM tl.tl_gm_sl_ali_virtual_phone_call_detail --通话记录表,call_type呼叫类型
WHERE partition_day=regexp_replace(date_sub(current_date(),1),'-','')
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')>='20200724'
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')>='20200701'
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')<=regexp_replace(date_sub(current_date(),1),'-','')
AND start_time+ interval 30 second <= release_time --通话时长大于30秒
)a
......@@ -262,7 +261,7 @@ LEFT JOIN
,1 AS consult_num
FROM online.AL_COMMUNITY_USER_VALID_CONSULT_DAY
WHERE
partition_date between '20200724' AND regexp_replace(date_sub(current_date(),1),'-','')
partition_date between '20200701' AND regexp_replace(date_sub(current_date(),1),'-','')
AND is_valid_consult='true'
AND merchant_id IS NOT NULL
GROUP BY user_id,merchant_id,substr(partition_date,1,6)
......@@ -278,7 +277,7 @@ LEFT JOIN
FROM ONLINE.ML_TRADE_ORDER_DETAIL_DAY T
WHERE
T.PARTITION_DATE = regexp_replace(date_sub(current_date(),1),'-','')
AND T.PAY_DATE between '2020-07-24' AND date_sub(current_date(),1)
AND T.PAY_DATE between '2020-07-01' AND date_sub(current_date(),1)
AND T.is_pure_user='true'
GROUP BY T.USER_ID,T.merchant_id,regexp_replace(SUBSTR(T.PAY_DATE,1,7),'-','')
) T4
......@@ -296,7 +295,7 @@ LEFT JOIN
SELECT sub_id,REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '') as partition_date
FROM tl.tl_gm_sl_ali_virtual_phone_call_detail --通话记录表,call_type呼叫类型
WHERE partition_day=regexp_replace(date_sub(current_date(),1),'-','')
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')>='20200724'
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')>='20200701'
AND REGEXP_REPLACE(SUBSTR(call_time,0,10), '-', '')<=regexp_replace(date_sub(current_date(),1),'-','')
AND start_time+ interval 30 second <= release_time --通话时长大于30秒
)a
......@@ -383,7 +382,7 @@ LEFT JOIN
SELECT t.user_id,partition_date,
if(size(t.device_list) > 0, device_list [ 0 ], '') device_id
FROM online.ml_user_updates t
WHERE t.partition_date >= '20200724'
WHERE t.partition_date >= '20200701'
and t.partition_date <=regexp_replace(date_sub(current_date(),1),'-','')
)T3
ON T1.user_id = T3.user_id
......@@ -392,7 +391,7 @@ LEFT JOIN
( -- 1.去掉机刷、积分墙渠道来的设备
SELECT partition_date,device_id
FROM online.ml_device_day_active_status
where partition_date >= '20200724'
where partition_date >= '20200701'
AND partition_date <=regexp_replace(date_sub(current_date(),1),'-','')
AND active_type in ('1','2','4')
)dev
......
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