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

指标统计sql脚本

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