当前位置:网站首页>G biaxial graph SQL script
G biaxial graph SQL script
2022-06-28 19:02:00 【South Lake Fishing Song】
# ----------------------- consumption -----------------------
-- temp_bi_df_m tb surface :
select
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
a.consume as consumption ,
b.consume as Month on month
-- round((a.consume-b.consume)/b.consume,2) as month_rate
from
(
select ym as d,consume
from (select ym,sum(consume) as consume -- According to :r_year,r_month grouping Become installation ym Field grouping
from temp_bi_df_m tb
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
where channel_kind in ($channel_kind) AND brand_name in ($brand_name) -- Change to variable sql
group by ym) t ) a
left join
(
-- Run right
select DATE_ADD(ym,INTERVAL 1 month ) as dd
,ym as original_month
,consume
from
(
select ym,sum(consume) as consume
from temp_bi_df_m tb
where channel_kind in ($channel_kind) AND brand_name in ($brand_name)
group by ym) t
) b
on a.d = b.dd;
-- bi_df_m tb surface :
select
-- substr(a.d,1,7) as month ,
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
round(a.consume) as consumption ,
-- b.dd,
-- b.original_month,
round(b.consume) as Month on month , -- as consume_last,
-- round((a.consume-b.consume)/b.consume,2) as Month on month growth rate -- month_rate
from
(
select DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as d,consume
from
(
select r_year,r_month,sum(consume) as consume
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) a
left join
(
-- Run right
select DATE_ADD(DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d'),INTERVAL 1 month ) as dd
,DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as original_month
,consume
from
(
select r_year,r_month,sum(consume) as consume
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) b
on a.d = b.dd;
# ----------------------- register -----------------------
-- temp_bi_df_m tb surface :
select
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
a.reg as Number of registrations ,
b.reg as Month on month
-- round((a.reg-b.reg)/b.reg,2) as month_rate
from
(
select ym as d,reg
from (select ym,sum(reg) as reg -- According to :r_year,r_month grouping Become installation ym Field grouping
from temp_bi_df_m tb
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
where channel_kind in ($channel_kind) AND brand_name in ($brand_name)
group by ym) t ) a
left join
(
-- Run right
select DATE_ADD(ym,INTERVAL 1 month ) as dd
,ym as original_month
,reg
from
(
select ym,sum(reg) as reg
from temp_bi_df_m tb
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
where channel_kind in ($channel_kind) AND brand_name in ($brand_name)
group by ym) t
) b
on a.d = b.dd;
-- bi_df_m tb surface :
select
-- substr(a.d,1,7) as month ,
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
round(a.reg) as Number of registrations ,
-- b.dd,
-- b.original_month,
round(b.reg) as Month on month , -- as reg_last,
round((a.reg-b.reg)/b.reg,2) as Month on month growth rate -- month_rate
from
(
select DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as d,reg
from
(
select r_year,r_month,sum(reg) as reg
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) a
left join
(
-- Run right
select DATE_ADD(DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d'),INTERVAL 1 month ) as dd
,DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as original_month
,reg
from
(
select r_year,r_month,sum(reg) as reg
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) b
on a.d = b.dd;
# ----------------------- Into gold -----------------------
-- temp_bi_df_m tb surface :
select
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
a.ent as Amount of deposit ,
b.ent as Month on month
-- round((a.ent-b.ent)/b.ent,2) as month_rate
from
(
select ym as d,ent
from (select ym,sum(ent) as ent -- According to :r_year,r_month grouping Become installation ym Field grouping
from temp_bi_df_m tb
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
where channel_kind in ($channel_kind) AND brand_name in ($brand_name)
group by ym) t ) a
left join
(
-- Run right
select DATE_ADD(ym,INTERVAL 1 month ) as dd
,ym as original_month
,ent
from
(
select ym,sum(ent) as ent
from temp_bi_df_m tb
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
where channel_kind in ($channel_kind) AND brand_name in ($brand_name)
group by ym) t
) b
on a.d = b.dd;
-- bi_df_m tb surface :
select
-- substr(a.d,1,7) as month ,
STR_TO_DATE(a.d,'%Y-%m-%d') as time,
round(a.ent) as Amount of deposit ,
-- b.dd,
-- b.original_month,
round(b.ent) as Month on month , -- as ent_last,
round((a.ent-b.ent)/b.ent,2) as Month on month growth rate -- month_rate
from
(
select DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as d,ent
from
(
select r_year,r_month,sum(ent) as ent
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) a
left join
(
-- Run right
select DATE_ADD(DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d'),INTERVAL 1 month ) as dd
,DATE_FORMAT(CONCAT(r_year,'-',r_month,'-01'),'%Y-%m-%d') as original_month
,ent
from
(
select r_year,r_month,sum(ent) as ent
from grafana_bi.bi_df_m bdm
-- where channel_kind = 'APP' AND brand_name = '2_bibgold'
group by r_year,r_month) t
) b
on a.d = b.dd;
边栏推荐
- 新工作第一天
- Record an emotet Trojan horse handling case
- Anonymous function variable problem
- Idea merge other branches into dev branch
- 毕业设计-基于Unity的餐厅经营游戏的设计与开发(附源码、开题报告、论文、答辩PPT、演示视频,带数据库)
- 618 activity season - the arrival of special discounts for hundreds of low code platforms
- AOSP清华镜像下载错误解决
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
- Mybayis之核心主件分析
- Memory leak
猜你喜欢
随机推荐
An in-depth analysis of the election mechanism in kubernetes
Taishan Office Technology Lecture: word strange font height
Modular operation
Cross cluster deployment of helm applications using karmada
idea其他分支合并到dev分支
匿名函数变量问题
福建的朋友们,你们的养老保险上云啦!
Analysis of the core components of mybayis
Memory leak
深入解析kubernetes中的选举机制
牛津大学教授Michael Wooldridge:AI社区近40年如何看待神经网络
毕业设计-基于Unity的餐厅经营游戏的设计与开发(附源码、开题报告、论文、答辩PPT、演示视频,带数据库)
Upload file list (repeated file names are marked with brackets)
Idea merge other branches into dev branch
Rxjs map, mergeMap 和 switchMap 的区别和联系
[unity3d] emission (raycast) physical ray (Ray)
Openfire 3.8.2集群配置
微博评论的高性能高可用计算架构方案
Enhancing steam and engineering education from theory to practice
使用Karmada实现Helm应用的跨集群部署







![[unity3d] emission (raycast) physical ray (Ray)](/img/46/a9fda743f597db9584c982b10c191c.png)
