Commit 578b9177 authored by 胡涛's avatar 胡涛

指标统计sql脚本

parent 05c5d5e9
...@@ -12,7 +12,7 @@ select ...@@ -12,7 +12,7 @@ select
, a1.`LEVEL3COMCODE` as `LEVEL3COMCODE` , a1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
, a1.`LEVEL4COMCODE` as `LEVEL4COMCODE` , a1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
, a1.`startTime` as `startTime` , a1.`startTime` as `startTime`
, a1.`cost`+ if(t1.cost is null ,0,cast(t1.cost as decimal(18,2))) as `cost` , cast (a1.`cost`+ if(t1.cost is null ,0,cast(t1.cost as decimal(18,2))) as varchar ) as `cost`
, a1.`log_time` as `log_time` , a1.`log_time` as `log_time`
from ( from (
...@@ -23,10 +23,10 @@ from ( ...@@ -23,10 +23,10 @@ from (
, s1.`LEVEL3COMCODE` as `LEVEL3COMCODE` , s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
, s1.`LEVEL4COMCODE` as `LEVEL4COMCODE` , s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
, s1.`startTime` as `startTime` , s1.`startTime` as `startTime`
, cast (sum(cast(s1.`cost` as DECIMAL(18, 2))) as varchar ) as `cost` , sum(cast(s1.`cost` as DECIMAL(18, 2))) as `cost`
, cast (DateTimeToLongUDF(tumble_end(s1.row_time, interval '1' hour) ) as varchar) as `log_time` , cast (DateTimeToLongUDF(tumble_end(s1.row_time, interval '1' hour) ) as varchar) as `log_time`
, max(s1.proctime) as proctime , max(s1.proctime) as proctime
from ZB_ODS.ZB_ODS_KAFKA.CBDATA from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where where
`COMNAME` is not null `COMNAME` is not null
and LEFT(`uwConclueDate`,8) = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd') and LEFT(`uwConclueDate`,8) = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
...@@ -39,10 +39,10 @@ from ( ...@@ -39,10 +39,10 @@ from (
, s1.`startTime` , s1.`startTime`
, tumble(s1.row_time, interval '1' hour) , tumble(s1.row_time, interval '1' hour)
)a1 )a1
left join ZB_DM.ZB_DM_MYSQL.TEAM_ALL for system_time as of s1.proctime as t1 left join ZB_DM.ZB_DM_MYSQL.TEAM_ALL for system_time as of a1.proctime as t1
on s1.`uwConclueDate` = t1.`uwConclueDate` on a1.`uwConclueDate` = t1.`uwConclueDate`
and s1.`LEVEL4COMCODE` = t1.`LEVEL4COMCODE` and a1.`LEVEL4COMCODE` = t1.`LEVEL4COMCODE`
and s1.`startTime` = t1.`startTime` and a1.`startTime` = t1.`startTime`
; ;
......
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