Commit 70f661eb authored by 胡涛's avatar 胡涛

指标统计sql脚本

parent f56b3e5c
...@@ -42,7 +42,7 @@ group by ...@@ -42,7 +42,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provqbbf/' 'provqbbf/'
...@@ -57,7 +57,7 @@ group by ...@@ -57,7 +57,7 @@ group by
; ;
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'cityqbbf/' 'cityqbbf/'
...@@ -73,7 +73,7 @@ group by ...@@ -73,7 +73,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countryqbbf/' 'countryqbbf/'
...@@ -89,7 +89,7 @@ group by ...@@ -89,7 +89,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamqbbf/' 'teamqbbf/'
......
...@@ -30,16 +30,16 @@ from ( ...@@ -30,16 +30,16 @@ from (
,d1.`LEVEL1COMDESC` as `comname` ,d1.`LEVEL1COMDESC` as `comname`
,d1.`id` as `id` ,d1.`id` as `id`
,d1.`name` as `name` ,d1.`name` as `name`
,d1.`cost` as `cost` ,cast(d1.`cost` AS VARCHAR ) as `cost`
,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate` ORDER BY d1.`cost` DESC) as rownum ,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate` ORDER BY d1.`cost` DESC) as rownum
from ( from (
select select
`uwConclueDate` as `uwConclueDate` `uwConclueDate` as `uwConclueDate`
,`LEVEL1COMCODE` as `LEVEL1COMCODE` ,`LEVEL1COMCODE` as `LEVEL1COMCODE`
,`LEVEL1COMDESC` as `LEVEL1COMDESC` ,`LEVEL1COMDESC` as `LEVEL1COMDESC`
,`id` as `id` ,`id` as `id`
,`name` as `name` ,`name` as `name`
,sum(`cost`) as `cost` ,sum(cast(`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA from ZB_ODS.ZB_ODS_KAFKA.CBDATA
where where
`COMNAME` is not null `COMNAME` is not null
...@@ -95,7 +95,7 @@ from ( ...@@ -95,7 +95,7 @@ from (
,d1.`LEVEL2COMDESC` as `cityname` ,d1.`LEVEL2COMDESC` as `cityname`
,d1.`id` as `id` ,d1.`id` as `id`
,d1.`name` as `name` ,d1.`name` as `name`
,d1.`cost` as `cost` ,cast(d1.`cost` AS VARCHAR ) as `cost`
,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate`,d1.`LEVEL1COMCODE` ORDER BY d1.`cost` DESC) as rownum ,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate`,d1.`LEVEL1COMCODE` ORDER BY d1.`cost` DESC) as rownum
from ( from (
select select
...@@ -106,7 +106,7 @@ from ( ...@@ -106,7 +106,7 @@ from (
,`LEVEL2COMDESC` as `LEVEL2COMDESC` ,`LEVEL2COMDESC` as `LEVEL2COMDESC`
,`id` as `id` ,`id` as `id`
,`name` as `name` ,`name` as `name`
,sum(`cost`) as `cost` ,sum(cast(`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA from ZB_ODS.ZB_ODS_KAFKA.CBDATA
where where
`COMNAME` is not null `COMNAME` is not null
...@@ -168,7 +168,7 @@ from ( ...@@ -168,7 +168,7 @@ from (
,d1.`LEVEL3COMDESC` as `countryname` ,d1.`LEVEL3COMDESC` as `countryname`
,d1.`id` as `id` ,d1.`id` as `id`
,d1.`name` as `name` ,d1.`name` as `name`
,d1.`cost` as `cost` ,cast(d1.`cost` AS VARCHAR ) as `cost`
,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate`,d1.`LEVEL2COMCODE` ORDER BY d1.`cost` DESC) as rownum ,ROW_NUMBER() OVER(PARTITION BY d1.`uwConclueDate`,d1.`LEVEL2COMCODE` ORDER BY d1.`cost` DESC) as rownum
from ( from (
select select
...@@ -181,7 +181,7 @@ from ( ...@@ -181,7 +181,7 @@ from (
,`LEVEL3COMDESC` as `LEVEL3COMDESC` ,`LEVEL3COMDESC` as `LEVEL3COMDESC`
,`id` as `id` ,`id` as `id`
,`name` as `name` ,`name` as `name`
,sum(`cost`) as `cost` ,sum(cast(`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA from ZB_ODS.ZB_ODS_KAFKA.CBDATA
where where
`COMNAME` is not null `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