Commit 23720e9d authored by 王东's avatar 王东

指标计算承保字段调整

parent dc7cdc6d
......@@ -11,16 +11,38 @@ SELECT
, s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
, s1.`startTime` as `startTime`
, s1.`risk` as `risk`
, sum(cast(s1.`cost` as DECIMAL(18, 2))) as `cost`
, sum(cast(s1.`cost` as DECIMAL(18, 2))) + t1.`cost` as `cost`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
left join ZB_DM.ZB_DM_MYSQL.TEAM for system_time as of s1.proctime as t1
on s1.`uwConclueDate` = s1.`uwConclueDate`
and s1.`LEVEL1COMCODE` = s1.`LEVEL1COMCODE`
and s1.`LEVEL2COMCODE` = s1.`LEVEL2COMCODE`
and s1.`LEVEL3COMCODE` = s1.`LEVEL3COMCODE`
and s1.`LEVEL4COMCODE` = s1.`LEVEL4COMCODE`
and s1.`startTime` = s1.`startTime`
and s1.`risk` = s1.`risk`
left join (
select
`uwConclueDate` as `uwConclueDate`
,`LEVEL1COMCODE` as `LEVEL1COMCODE`
,`LEVEL2COMCODE` as `LEVEL2COMCODE`
,`LEVEL3COMCODE` as `LEVEL3COMCODE`
,`LEVEL4COMCODE` as `LEVEL4COMCODE`
,`startTime` as `startTime`
,`risk` as `risk`
,left(t1.log_time,8) as log_time
,sum(cast(cost as decimal(18,2))) as `cost`
from ZB_DM.ZB_DM_MYSQL.TEAM
where `uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
group by
`uwConclueDate`
,`LEVEL1COMCODE`
,`LEVEL2COMCODE`
,`LEVEL3COMCODE`
,`LEVEL4COMCODE`
,`startTime`
,`risk`
,left(t1.log_time,8)
) for system_time as of s1.proctime as t1
on s1.`uwConclueDate` = t1.`uwConclueDate`
and s1.`LEVEL1COMCODE` = t1.`LEVEL1COMCODE`
and s1.`LEVEL2COMCODE` = t1.`LEVEL2COMCODE`
and s1.`LEVEL3COMCODE` = t1.`LEVEL3COMCODE`
and s1.`LEVEL4COMCODE` = t1.`LEVEL4COMCODE`
and s1.`startTime` = t1.`startTime`
and s1.`risk` = t1.`risk`
and left(t1.log_time,8) = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
where
s1.`COMNAME` is not null
......
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