Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
1fbbd22c
Commit
1fbbd22c
authored
Jul 31, 2020
by
yindanlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fangan_day report codes
parent
9d976098
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
fangan_day.sql
pm/fangan_day/etl/fangan_day.sql
+9
-10
No files found.
pm/fangan_day/etl/fangan_day.sql
View file @
1fbbd22c
...
@@ -80,8 +80,7 @@ FROM
...
@@ -80,8 +80,7 @@ FROM
SELECT
device_id
SELECT
device_id
,
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
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
FROM
online
.
ml_device_day_active_status
WHERE
partition_date
>=
'20200724'
WHERE
partition_date
>=
'20200724'
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
)
t
)
t
on
t1
.
device_id
=
t
.
device_id
on
t1
.
device_id
=
t
.
device_id
GROUP
BY
t1
.
partition_date
,
t1
.
device_id
,
device_type
,
grey_type
,
device_os_type
,
channel_type
GROUP
BY
t1
.
partition_date
,
t1
.
device_id
,
device_type
,
grey_type
,
device_os_type
,
channel_type
...
@@ -146,7 +145,7 @@ LEFT JOIN
...
@@ -146,7 +145,7 @@ LEFT JOIN
,
1
AS
consult_num
,
1
AS
consult_num
FROM
online
.
AL_COMMUNITY_USER_VALID_CONSULT_DAY
FROM
online
.
AL_COMMUNITY_USER_VALID_CONSULT_DAY
WHERE
WHERE
partition_date
between
'202007
24
'
AND
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
partition_date
between
'202007
01
'
AND
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
is_valid_consult
=
'true'
AND
is_valid_consult
=
'true'
AND
merchant_id
IS
NOT
NULL
AND
merchant_id
IS
NOT
NULL
GROUP
BY
user_id
,
merchant_id
,
substr
(
partition_date
,
1
,
6
)
GROUP
BY
user_id
,
merchant_id
,
substr
(
partition_date
,
1
,
6
)
...
@@ -162,7 +161,7 @@ LEFT JOIN
...
@@ -162,7 +161,7 @@ LEFT JOIN
FROM
ONLINE
.
ML_TRADE_ORDER_DETAIL_DAY
T
FROM
ONLINE
.
ML_TRADE_ORDER_DETAIL_DAY
T
WHERE
WHERE
T
.
PARTITION_DATE
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
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'
AND
T
.
is_pure_user
=
'true'
GROUP
BY
T
.
USER_ID
,
T
.
merchant_id
,
regexp_replace
(
SUBSTR
(
T
.
PAY_DATE
,
1
,
7
),
'-'
,
''
)
GROUP
BY
T
.
USER_ID
,
T
.
merchant_id
,
regexp_replace
(
SUBSTR
(
T
.
PAY_DATE
,
1
,
7
),
'-'
,
''
)
)
T4
)
T4
...
@@ -180,7 +179,7 @@ LEFT JOIN
...
@@ -180,7 +179,7 @@ LEFT JOIN
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
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呼叫类型
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
'202007
24
'
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
'202007
01
'
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
start_time
+
interval
30
second
<=
release_time
--通话时长大于30秒
AND
start_time
+
interval
30
second
<=
release_time
--通话时长大于30秒
)
a
)
a
...
@@ -262,7 +261,7 @@ LEFT JOIN
...
@@ -262,7 +261,7 @@ LEFT JOIN
,
1
AS
consult_num
,
1
AS
consult_num
FROM
online
.
AL_COMMUNITY_USER_VALID_CONSULT_DAY
FROM
online
.
AL_COMMUNITY_USER_VALID_CONSULT_DAY
WHERE
WHERE
partition_date
between
'202007
24
'
AND
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
partition_date
between
'202007
01
'
AND
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
is_valid_consult
=
'true'
AND
is_valid_consult
=
'true'
AND
merchant_id
IS
NOT
NULL
AND
merchant_id
IS
NOT
NULL
GROUP
BY
user_id
,
merchant_id
,
substr
(
partition_date
,
1
,
6
)
GROUP
BY
user_id
,
merchant_id
,
substr
(
partition_date
,
1
,
6
)
...
@@ -278,7 +277,7 @@ LEFT JOIN
...
@@ -278,7 +277,7 @@ LEFT JOIN
FROM
ONLINE
.
ML_TRADE_ORDER_DETAIL_DAY
T
FROM
ONLINE
.
ML_TRADE_ORDER_DETAIL_DAY
T
WHERE
WHERE
T
.
PARTITION_DATE
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
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'
AND
T
.
is_pure_user
=
'true'
GROUP
BY
T
.
USER_ID
,
T
.
merchant_id
,
regexp_replace
(
SUBSTR
(
T
.
PAY_DATE
,
1
,
7
),
'-'
,
''
)
GROUP
BY
T
.
USER_ID
,
T
.
merchant_id
,
regexp_replace
(
SUBSTR
(
T
.
PAY_DATE
,
1
,
7
),
'-'
,
''
)
)
T4
)
T4
...
@@ -296,7 +295,7 @@ LEFT JOIN
...
@@ -296,7 +295,7 @@ LEFT JOIN
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
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呼叫类型
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
'202007
24
'
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
'202007
01
'
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
start_time
+
interval
30
second
<=
release_time
--通话时长大于30秒
AND
start_time
+
interval
30
second
<=
release_time
--通话时长大于30秒
)
a
)
a
...
@@ -383,7 +382,7 @@ LEFT JOIN
...
@@ -383,7 +382,7 @@ LEFT JOIN
SELECT
t
.
user_id
,
partition_date
,
SELECT
t
.
user_id
,
partition_date
,
if
(
size
(
t
.
device_list
)
>
0
,
device_list
[
0
],
''
)
device_id
if
(
size
(
t
.
device_list
)
>
0
,
device_list
[
0
],
''
)
device_id
FROM
online
.
ml_user_updates
t
FROM
online
.
ml_user_updates
t
WHERE
t
.
partition_date
>=
'202007
24
'
WHERE
t
.
partition_date
>=
'202007
01
'
and
t
.
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
t
.
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
)
T3
)
T3
ON
T1
.
user_id
=
T3
.
user_id
ON
T1
.
user_id
=
T3
.
user_id
...
@@ -392,7 +391,7 @@ LEFT JOIN
...
@@ -392,7 +391,7 @@ LEFT JOIN
(
-- 1.去掉机刷、积分墙渠道来的设备
(
-- 1.去掉机刷、积分墙渠道来的设备
SELECT
partition_date
,
device_id
SELECT
partition_date
,
device_id
FROM
online
.
ml_device_day_active_status
FROM
online
.
ml_device_day_active_status
where
partition_date
>=
'202007
24
'
where
partition_date
>=
'202007
01
'
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
)
dev
)
dev
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment